Array
Posted: Tue Mar 18, 2003 1:50 pm
The instruction mysql_fetch_array presents the following
error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource on line 15
The script:
<?
$db = mysql_connect("localhost", "user", "pass");
mysql_select_db("auth",$db);
$result = mysql_query("SELECT * FROM personal",$db);
if ($myrow = mysql_fetch_array($result)) {
echo "<table border=1>\n"; echo "<tr><td>Name</td><td>Position</td></tr>\n";
do {printf("<tr><td>%s %s</td><td>%s</tr>\n", $myrow["Legajo"], $myrow["Nombre"], $myrow["email1"]);
}
while ($myrow = mysql_fetch_array($result));
echo "</table>\n";} else { echo "Sorry, no records were found!"; }
?>
error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource on line 15
The script:
<?
$db = mysql_connect("localhost", "user", "pass");
mysql_select_db("auth",$db);
$result = mysql_query("SELECT * FROM personal",$db);
if ($myrow = mysql_fetch_array($result)) {
echo "<table border=1>\n"; echo "<tr><td>Name</td><td>Position</td></tr>\n";
do {printf("<tr><td>%s %s</td><td>%s</tr>\n", $myrow["Legajo"], $myrow["Nombre"], $myrow["email1"]);
}
while ($myrow = mysql_fetch_array($result));
echo "</table>\n";} else { echo "Sorry, no records were found!"; }
?>