Re: valid MySQL result resource
| From: | Foong | Date: | Tue, 14 Jan 2003 18:16:19 +0000 |
| Subject: | Re: valid MySQL result resource | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131599@lists.php.net to get a copy of this message | ||
put the following line after you call mysql_query(..), you should be able to
see the error:
echo mysql_error();
this line is very handy to see what's wrong with mysql related operation.
Remember to delete it after debugging for security reasons
Foong
Brent Lee <brent.lee@sympatico.ca> wrote in message
news:20030114165359.13769.qmail@pb1.pair.com...
> Here is another error I'm getting while trying to view my db. I copied
> and pasted these statements from a pdf file I'm using to learn PHP but
they
> keep creating errors.
> I am writing all your tips into my notes to try to keep my questioning
> to a minimal.
>
> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
> result resource in /home/xxxxxxx/public_html/Info/viewdb.php on line 8
>
>
>
> <HTML>
> <?php
> $db = mysql_connect('localhost', 'xxxxx', 'xxxxxxx');
> mysql_select_db('learndb',$db);
> $result = mysql_query("SELECT * FROM personnel",$db);
> echo "<TABLE>";
> echo"<TR><TD><B>Full Name</B><TD><B>Nick
> Name</B><TD><B>Salary</B></TR>";
> while ($myrow = mysql_fetch_array($result))
> {
> echo "<TR><TD>";
> echo $myrow["firstname"];
> echo " ";
> echo $myrow["lastname"];
> echo "<TD>";
> echo $myrow["nick"];
> echo "<TD>";
> echo $myrow["salary"];
> }
> echo "</TABLE>";
> ?>
> </HTML>
>
>
> --
>
> Thanks
> ______________________________
> Brent Lee
>
>