phpbar.de logo

Mailinglisten-Archive

[php] Fehler bei der Datenbank-Abfrage

[php] Fehler bei der Datenbank-Abfrage

tobias php_(at)_phpcenter.de
Wed, 11 Apr 2001 10:12:28 +0200


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------ =_NextPart_001_01C0C25F.2630C0F0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hallo,

ich habe folgendes Problem:
Ich versuche auf eine mySQl-Datenbank zuzugreifen. Dies ist der
Quelltext meiner Abfrage:

<html><body><div align=3D"center">
<?


$db =3D mysql_connect("localhost","root");
mysql_select_db("mailconfig",$db);
$result =3D mysql_query("SELECT * FROM kunden",$db);

?>

<table border=3D"1" cellspacing=3D"0" cellpadding=3D"3" =
align=3D"center">
<tr>
<td><b>ID</b></td>
<td><b>Name</b></td>
<td><b>Firma</b></td>
<td><b>Herr/Frau</b></td>
<td><b>e-mail</b></td>
<td><b>Tel</b></td>
<td><b>Strasse</b></td>
<td><b>Handy</b></td>
<td><b>PLZ</b></td>
<td><b>Ort</b></td>
</tr>

<? while ($daten =3D mysql_fetch_array($result)) { ?>

<tr>
<td><? echo $daten[KID]; ?></td>
<td><? echo $daten[name]; ?></td>
<td><? echo $daten[firma]; ?></td>
<td><? echo $daten[anrede]; ?></td>
<td><? echo '<a =
href=3D"mailto:'.$daten[email].'">'.$daten[email].'</a>';
?></td>
<td><? echo $daten[tel]; ?></td>
<td><? echo $daten[strasse]; ?></td>
<td><? echo $daten[mobil]; ?></td>
<td><? echo $daten[plz]; ?></td>
<td><? echo $daten[ort]; ?></td>
</tr>

<? } ?>

</table></div></body></html>

Doch dann kommt folgende Ausgabe:

Warning: Supplied argument is not a valid MySQL result resource in
/customer/websites/mailconfig/htdocs/dev/uebersicht.php on line 25

Also hier:=20

<? while ($daten =3D mysql_fetch_array($result)) { ?>=20

macht er Probleme.

Woran mags liegen?

W=FCrde mich =FCber eine Antwort freuen.

Mit freundlichen Gr=FC=DFen

Tobias Pusch


------ =_NextPart_001_01C0C25F.2630C0F0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">


<META content=3D"MSHTML 5.00.2920.0" name=3DGENERATOR></HEAD>
<BODY>
<DIV>
<P><FONT face=3DVerdana size=3D2>Hallo,</FONT></P>
<P><FONT face=3DVerdana size=3D2>ich habe folgendes =
Problem:</FONT><FONT=20
face=3DVerdana size=3D2><BR>Ich versuche auf eine mySQl-Datenbank =
zuzugreifen. Dies=20
ist der Quelltext meiner Abfrage:</FONT></P>
<P><FONT face=3DVerdana size=3D2>&lt;html&gt;&lt;body&gt;&lt;div=20
align=3D"center"&gt;<BR></FONT><FONT face=3DVerdana =
size=3D2>&lt;?<BR></FONT><FONT=20
face=3DVerdana size=3D2></FONT></P>
<P><FONT face=3DVerdana size=3D2>$db =3D=20
mysql_connect("localhost","root");<BR></FONT><FONT face=3DVerdana=20
size=3D2>mysql_select_db("mailconfig",$db);<BR></FONT><FONT =
face=3DVerdana=20
size=3D2>$result =3D mysql_query("SELECT * FROM =
kunden",$db);</FONT></P>
<P><FONT face=3DVerdana size=3D2>?&gt;</FONT></P>
<P><FONT face=3DVerdana size=3D2>&lt;table border=3D"1" =
cellspacing=3D"0"=20
cellpadding=3D"3" align=3D"center"&gt;<BR></FONT><FONT face=3DVerdana=20
size=3D2>&lt;tr&gt;<BR></FONT><FONT face=3DVerdana=20
size=3D2>&lt;td&gt;&lt;b&gt;ID&lt;/b&gt;&lt;/td&gt;<BR></FONT><FONT =
face=3DVerdana=20
size=3D2>&lt;td&gt;&lt;b&gt;Name&lt;/b&gt;&lt;/td&gt;<BR></FONT><FONT =
face=3DVerdana=20
size=3D2>&lt;td&gt;&lt;b&gt;Firma&lt;/b&gt;&lt;/td&gt;<BR></FONT><FONT=20
face=3DVerdana=20
size=3D2>&lt;td&gt;&lt;b&gt;Herr/Frau&lt;/b&gt;&lt;/td&gt;<BR></FONT><FO=
NT=20
face=3DVerdana=20
size=3D2>&lt;td&gt;&lt;b&gt;e-mail&lt;/b&gt;&lt;/td&gt;<BR></FONT><FONT =

face=3DVerdana =
size=3D2>&lt;td&gt;&lt;b&gt;Tel&lt;/b&gt;&lt;/td&gt;<BR></FONT><FONT=20
face=3DVerdana=20
size=3D2>&lt;td&gt;&lt;b&gt;Strasse&lt;/b&gt;&lt;/td&gt;<BR></FONT><FONT=
=20
face=3DVerdana=20
size=3D2>&lt;td&gt;&lt;b&gt;Handy&lt;/b&gt;&lt;/td&gt;<BR></FONT><FONT=20
face=3DVerdana =
size=3D2>&lt;td&gt;&lt;b&gt;PLZ&lt;/b&gt;&lt;/td&gt;<BR></FONT><FONT=20
face=3DVerdana =
size=3D2>&lt;td&gt;&lt;b&gt;Ort&lt;/b&gt;&lt;/td&gt;<BR></FONT><FONT=20
face=3DVerdana size=3D2>&lt;/tr&gt;</FONT></P>
<P><FONT face=3DVerdana size=3D2>&lt;? while ($daten =3D =
mysql_fetch_array($result)) {=20
?&gt;</FONT></P>
<P><FONT face=3DVerdana size=3D2>&lt;tr&gt;<BR></FONT><FONT =
face=3DVerdana=20
size=3D2>&lt;td&gt;&lt;? echo $daten[KID]; =
?&gt;&lt;/td&gt;<BR></FONT><FONT=20
face=3DVerdana size=3D2>&lt;td&gt;&lt;? echo $daten[name];=20
?&gt;&lt;/td&gt;<BR></FONT><FONT face=3DVerdana =
size=3D2>&lt;td&gt;&lt;? echo=20
$daten[firma]; ?&gt;&lt;/td&gt;<BR></FONT><FONT face=3DVerdana=20
size=3D2>&lt;td&gt;&lt;? echo $daten[anrede]; ?&gt;&lt;/td&gt;<BR><SPAN =

class=3D697120708-11042001>&lt;</SPAN>td&gt;&lt;? echo '&lt;a=20
href=3D"mailto:'.$daten[email].'"&gt;'.$daten[email].'&lt;/a&gt;';=20
?&gt;&lt;/td&gt;</FONT><FONT face=3DVerdana =
size=3D2><BR>&lt;td&gt;&lt;? echo=20
$daten[tel]; ?&gt;&lt;/td&gt;</FONT><FONT face=3DVerdana=20
size=3D2><BR>&lt;td&gt;&lt;? echo $daten[strasse];=20
?&gt;&lt;/td&gt;<BR></FONT><FONT face=3DVerdana =
size=3D2>&lt;td&gt;&lt;? echo=20
$daten[mobil]; ?&gt;&lt;/td&gt;<BR></FONT><FONT face=3DVerdana=20
size=3D2>&lt;td&gt;&lt;? echo $daten[plz]; =
?&gt;&lt;/td&gt;<BR></FONT><FONT=20
face=3DVerdana size=3D2>&lt;td&gt;&lt;? echo $daten[ort];=20
?&gt;&lt;/td&gt;</FONT><FONT face=3DVerdana =
size=3D2><BR>&lt;/tr&gt;</FONT></P>
<P><FONT face=3DVerdana size=3D2>&lt;? } ?&gt;</FONT></P>
<P><FONT face=3DVerdana=20
size=3D2>&lt;/table&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;</FONT></P>=

<P><FONT face=3DVerdana size=3D2>Doch dann kommt folgende =
Ausgabe:</FONT></P>
<P><FONT face=3DVerdana size=3D2>Warning: Supplied argument is not a =
valid MySQL=20
result resource in =
/customer/websites/mailconfig/htdocs/dev/uebersicht.php on=20
line 25</FONT></P>
<P><FONT face=3DArial><SPAN class=3D697120708-11042001><FONT =
size=3D2>Also hier:=20
</FONT></P>
<P><FONT size=3D2><FONT face=3DVerdana>&lt;? while ($daten =3D=20
mysql_fetch_array($result)) { ?&gt;<SPAN class=3D697120708-11042001>=20
</SPAN></FONT></FONT></P>
<P><FONT size=3D2><FONT face=3DVerdana><SPAN =
class=3D697120708-11042001>macht er=20
Probleme.</SPAN></FONT></FONT></P></SPAN></FONT>
<P><FONT face=3DVerdana size=3D2>Woran mags liegen?</FONT></P>
<P><FONT face=3DVerdana size=3D2>W=FCrde mich =FCber eine Antwort =
freuen.</FONT></P>
<P><FONT face=3DVerdana size=3D2>Mit freundlichen Gr=FC=DFen</FONT></P>
<P><FONT face=3DVerdana size=3D2>Tobias =
Pusch</FONT></P></DIV></BODY></HTML>

------ =_NextPart_001_01C0C25F.2630C0F0--


php::bar PHP Wiki   -   Listenarchive