Hello,
»» $con = mysql_connect('localhost', '****', '****');
»» if (!$con)
hmh, hier kümmerst du dich noch um Fehlerbehandlung...»» mysql_select_db("****", $con);
»» $result = mysql_query($sql);
...hier nicht mehr.»» while($row = mysql_fetch_array($result))
damit greifst du hier ggf. auf etwas zu, was NICHT das Ergebnis einer MySQL-Abfrage ist, wie dir die Fehlermeldung auch sagt.MfG
Rouven
Da ich das ganze aus diesem Beispiel entwickelt habe (welches auch funktionierte!), glaube ich nicht das es direkt an den oben genannten Stellen liegt.
Das Beispiel:
<?php
$q=$_GET["q"];
$con = mysql_connect('localhost', 'peter', 'abc123');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ajax_demo", $con);
$sql="SELECT * FROM user WHERE id = '".$q."'";
$result = mysql_query($sql);
echo "<table border='1'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
<th>Hometown</th>
<th>Job</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['FirstName'] . "</td>";
echo "<td>" . $row['LastName'] . "</td>";
echo "<td>" . $row['Age'] . "</td>";
echo "<td>" . $row['Hometown'] . "</td>";
echo "<td>" . $row['Job'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
Quelle:Link