Re: Now, why doesn't this work?
| From: | David Robley | Date: | Tue, 24 Apr 2001 02:26:42 +0000 |
| Subject: | Re: Now, why doesn't this work? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49995@lists.php.net to get a copy of this message | ||
On Tue, 24 Apr 2001 11:50, Tyler Longren wrote:
> Hello everybody,
>
> My host seems to be having some weird problems.
> Here's a piece of code:
>
> if (($this_month_sql = mysql_query("SELECT * FROM $mysql_shows_table
> WHERE month = '$thismonth' ORDER BY timestamp ASC")) &&
> ($next_month_sql = mysql_query("SELECT * FROM $mysql_shows_table WHERE
> month = '$nextmonth' ORDER BY timestamp ASC"))) {
> do this();
> }
> else {
> print ("<font face=Arial size=2>MySQL query <b>DIDN'T RETURN
> DATA</b><br>Error No.:". mysql_errno(). "<br>MySQL Error:".
> mysql_error(). "</font><Br>");
> }
>
> Now, this is the error that I get from this:
> MySQL query DIDN'T RETURN DATA
> Error No.:1064
> MySQL Error:You have an error in your SQL syntax near 'WHERE month =
> '4' ORDER BY timestamp ASC' at line 1
>
> Why I get this, I don't know. The code hasn't changed in a few days,
> and it just started doing that today. This also works on my home Win2k
> box, and Slackware box. The versions of PHP, MySQL, and apache are the
> same on my host and on my Linux box. The version of php and mysql are
> the same on ALL of the machines (host, Win2k, Slackware).
>
> Any ideas?
>
> Thanks everyone,
> Tyler
IIRC the syntax error is just before the snippet returned by mysqlerror
so you might check the value in $mysql_shows_table is correct.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA