Re: Php error with MySql
| From: | Brian Tully | Date: | Thu, 06 Jan 2005 20:35:53 +0000 |
| Subject: | Re: Php error with MySql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-205775@lists.php.net to get a copy of this message | ||
sounds like there's something up with the query, perhaps the wrong table
name.
as a debugging method I usually use the die() clause when performing a query
so I can ensure the query is correct.
try using this:
$qResult = mysql_query ("SELECT * FROM blog_entries ORDER BY id DESC") or
die("could not run the query: " . mysql_error());
chances are there is not a "blog_entries" table or an "id" field in the
database you're connecting to.
hope that helps,
brian
on 1/6/05 12:50 PM, Wil Hitchman at wil.hitchman@iape1096.org wrote:
> I get the following error
>
> Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
> resource in /home/wilmail/public_html/elblog.php on line 7
> &n=& //error ends here
>
> with the following bit of code
>
> $qResult = mysql_query ("SELECT * FROM blog_entries ORDER BY id DESC");
>
> $nRows = mysql_num_rows($qResult);
> $rString ="&n=".$nRows;
>
> If I am just naming a variable how is the argument not valid?
>
> Thanks,
>
> Wil