Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP Problem

Empfohlene Antworten

dann hab ich doch gleih noch mal ne frage

<body>

<h1>Autoren verwalten</h1>

<ul>
<?php
// Verbindung zum Datenbankserver
$dbcnx = @mysql_connect('localhost', 'root', '1234');
if (!$dbcnx) {
exit('<p>Verbindungsaufbau zum Datenbankserver ' .
' zurzeit nicht möglich.</p>');
}

// Datenbank auswählen
if (!@mysql_select_db('jokes')) {
exit('<p>Auswahl der Witzedatenbank' .
'zurzeit nicht möglich.</p>');
}


$authors =@mysql_query('SELECT id, name FROM authors');
if (!$authors) {
exit('<p>Fehler beim Aufruf aus der Witzedatenbank!<br /> ' . 'Error: ' . mysql_error() . '</p>');
}

while ($author = mysql_fetch_array($authors)) {
$id = $author['id'];
$name = $htmlspecialchars($author['name']);

echo '<li>$name ' .
"<a href='editauthor.php?id=$id'>Bearbeiten</a>" .
"<a href='deleteauthor.php?id=$id'>Löschen</a></li>";
}
?>
</ul>
<p><a href="newauthor.php">Neuen Autor einfügen</a></p>
<p><a href="index.html">Zurück zur Startseite</a></p>


</body>[/PHP]

normalerweise hab ich alles richtig aber irgendwo hab ich nen fehler eingebaut aber ich kann ihn einfach nicht finden.

das kommt dan auf der seite:

[PHP]Autoren verwalten

Verbindungsaufbau zum Datenbankserver ' . ' zurzeit nicht möglich.'); } // Datenbank auswählen if (!@mysql_select_db('jokes')) { exit('

Auswahl der Witzedatenbank' . 'zurzeit nicht möglich.
'); } $authors =@mysql_query('SELECT id, name FROM authors'); if (!$authors) { exit('

Fehler beim Aufruf aus der Witzedatenbank!
' . 'Error: ' . mysql_error() . '
* '); } while ($author = mysql_fetch_array($authors)) { $id = $author['id']; $name = $htmlspecialchars($author['name']); echo '$name ' . "Bearbeiten" . "Löschen
"; } ?>

Neuen Autor einfügen

Zurück zur Startseite

so jetzt bekomme ich auf der seite folgende fehlermeldung:

Fatal error: Function name must be a string in C:\Apache2.2\htdocs\authors.php on line 35

das ist line 35:

$name = $htmlspecialchars($author['name']);

aber was sollte ich da in einen string machen wenn ich 'name' mit "" schreibe kommt der gleiche fehler.

"htmlspecialchars" soll doch eine Funktion und keine Variable sein, oder?

ja da könnteste recht haben......

jo hast

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Konto

Navigation

Suchen

Suchen

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.