RE: [PHP] Frustrating ?
| From: | Rick Emery | Date: | Mon, 18 Feb 2002 15:44:00 +0000 |
| Subject: | RE: [PHP] Frustrating ? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-85213@lists.php.net to get a copy of this message | ||
It means your query failed.
Change
$news = mysql_query('select * from ccl where '.$where.' order by AU desc');
TO:
$news = mysql_query('select * from ccl where '.$where.' order by AU desc')
or die("error: ".mysql_error());
this will display the error
-----Original Message-----
From: jtjohnston [mailto:taylorjo@collegesherbrooke.qc.ca]
Sent: Monday, February 18, 2002 12:30 AM
To: php-general@lists.php.net
Subject: [PHP] Frustrating ?
Heres's a frustrating, and maybe not so stupid question?
I'm getting "Warning: Supplied argument is not a valid MySQL result
resource" on this line:
while ($mydata = mysql_fetch_object($news))
So what am I doing wrong here:
$where = "id like $id";
$news = mysql_query('select * from ccl where '.$where.' order by AU desc');
//desc => z-a
while ($mydata = mysql_fetch_object($news))
{
echo "<tr bgcolor=\"#CCCCCC\"><td align=center><a
href=\"index.html?id=$mydata->id\">Print
View</a></td><td>$mydata->id</td><td>$mydata->AU</td><td>$mydata->ST</td><td
>$mydata->BT</td></tr>\n";
}#end of while
I've tried variations like:
$news = mysql_query('select * from ccl where id like $id order by AU
desc');
$news = mysql_query("select * from ccl where id like $id order by AU
desc");
$id checks out ok. I use index.html?id=4
AU exists; ok. So ... ?
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php