Hallo hab ein kleines Probleme ich möchte Daten aus einer Mysql Datenbank lessen mit folgender methode
Und auf der andern Seite ist der Code wie folgt
Ich bekomme diese Fehler Meldung
Fatal error: Call to undefined function: echoquery() in /kunden/75171_04317/test1/index.php on line 11
könnt ihr mir Bitte helfen ?
Code:
<?php class mysql_db { var $link = false; // Speichert die Verbindungs-ID zur Datenbank var $resid = false; // Speichert die Ressourcen-ID des letzten Aufrufs von mysql_query() var $doerror = true; // Hat den Wert True, wenn die Klasse Fehlermeldungen ausgeben soll var $host = "#"; // Hostname der MySQL-Datenbank var $user = "#"; // Benutzername var $passwd = "#"; // Passwort var $tables = "#"; // Datenbankname } function connect() // Verbindet zur Datenbank { $temp = @mysql_connect ($this->host, $this->user, $this->passwd); if (!$temp) { $this->echoerror(); return false; } $this->link = $temp; $temp = @mysql_select_db($this->tables, $temp); if (!$temp) { $this->echoerror(); return false; } return $this->link; } function query($sql) // Sendet eine Anfrage an die Datenbank { if (!$this->link) { if ($this->doerror) { echo ("Nicht verbunden. "); return false; } } if ($this->resid) @mysql_free_result($this->resid); $result = mysql_query($sql, $this->link); if (!$result) $this->echoerror(); $this->resid = $result; return $result; } function echoerror() // erzeugt eine Fehlerausschrift // wenn $doerror=TRUE { if (!$this->doerror) return; if (!mysql_errno()) return; echo ("<font color=\"red\">" . mysql_errno()); echo (": ". mysql_error() ." </font> "); } function data() // liefert einen Datensatz { if (!$this->link) { if ($this->doerror) echo ("Nicht verbunden! "); return false; } if (!$this->resid) { if ($this->doerror) echo ("Keine Abfrage! "); return false; } $result = mysql_fetch_array($this->resid, MYSQL_BOTH); $this->echoerror(); return $result; } function echoquery($sql) //Fragt die Datenbank ab und stellt die Abfrage dar { $this->query($sql); echo("<table border cellpadding=\"3\"><tr>"); $index = 0; echo("<th>record</th>"); while ($field = mysql_fetch_field($this->resid)) echo("<th>$field->name</th>"); echo ("</tr>\n"); $rec=0; while ($row = $this->data()) { $rec++; echo("<tr><td>$rec</td>"); for ($i=0; $i<mysql_num_fields($this->resid); $i++) echo("<td>".htmlentities($row[$i])."</td>"); echo("</tr>\n"); } echo ("</table>"); } function set_doerror($boolvalue) { $this->doerror = $boolvalue; } function mysql_db() // Construktor { $this->connect(); } $db = new mysql_db; ?>
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Unbenanntes Dokument</title> </head> <body> <?php include("config/mysqldb.php"); $db->echoquery("SELECT * FROM produkte"); ?> </body> </html>
Fatal error: Call to undefined function: echoquery() in /kunden/75171_04317/test1/index.php on line 11
könnt ihr mir Bitte helfen ?
Kommentar