Re: difference between php3 and php4
| From: | Todor Stoyanov | Date: | Fri, 22 Feb 2002 16:12:37 +0000 |
| Subject: | Re: difference between php3 and php4 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-85858@lists.php.net to get a copy of this message | ||
You must first get the number of record set rows.
The warning is because you trying to fetch a non existing row.
"Toni Baker" <tanknank@yahoo.com> wrote in message
news:20020222155919.77695.qmail@web20304.mail.yahoo.com...
> Warning: Supplied argument is not a valid MySQL result
> resource in c:\program files\apache
> group\apache\cgi-bin\emp.php3 on line 10
>
> $db = mysql_connect("localhost", "", "");
> mysql_select_db("employee",$db);
> $result = mysql_query("SELECT * FROM employees",$db);
> echo "<table border=0>";
> echo "<tr>";
> echo "<td bgcolor=#FAFOE6 colspan=2><B>Name</B></td>";
> echo "<td bgcolor=#FAFOE6><B>Address</B></td>";
> echo "<td bgcolor=#FAFOE6><B>Position</B></td>";
> echo "</tr>";
> while($row = mysql_fetch_row($result))
> {
> $fname = $row[1];
> $lname = $row[2];
> $address = $row[3];
> $position = $row[4];
> echo "<tr bgcolor=#C6E7DE>";
> echo "<td>$fname</td>";
> echo "<td>$lname</td>";
> echo "<td>$address</td>";
> echo "<td>$position</td>";
> echo "</tr>";
> }
>
> This script works in php3 but not in windows php4.
> The error message above points to the mysql_fetch_row
> function. Does this function work differently in
> php4? If not, what else might cause this script to
> work in php3 and not in php4?
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Sports - Coverage of the 2002 Olympic Games
> http://sports.yahoo.com