Re: Could not run query

From: Date: Sun, 28 Sep 2008 12:30:30 +0000
Subject: Re: Could not run query
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-45490@lists.php.net to get a copy of this message
> I need help to track down the cause of the error,"Could not run query" > > A typical query is > > $laterrecords = mysql_query("SELECT * FROM messages WHERE > logged > > $timebegin ORDER BY logged DESC" ) or die ("Cannot > select:<br>$query<br>Error: " . mysql_error()); Try putting single quotes around $timebegin. If $timebegin is not a Unix timestamp, you can also use the DATE functions in MySQL, A good way to debug these problems is to always put the query in a separate variable $query = "SELECT * FROM messages ..." //echo $query; //exit; $laterrecords = mysql_query($query); Then echo the actual interpolated query to the screen, copy it, and run it manually in a query tool (phpMyAdmin, MySQLQueryBrowser, or similar). The query tool will tell you where the error is. SK -- Sandy Keathley Zend Certified Engineer Senior Programmer The Dent Zone Companies, Inc. 214-393-2228

« previous php.db (#45490) next »