In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Jtjohnston) wrote:
> 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 A) Have you already confirmed that a valid database connection was made? B) String values in mysql have to be quoted. For example, "where foo='bar'" or "where foo like 'bar%'". C) Error checking on database operations is a really good idea. Even just a short "or die()" on the mysql_* calls can help you track down problems much more effectively. For example: $result=mysql_query($sql) or die("MySQL reports error: ". mysql_error() . " for query " . htmlentities($sql)); For more sophisticated error handling, see <http://www.php.net/manual/en/ref.errorfunc.php>. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php