MySQL Forums
Forum List  »  PHP

Mysql query will not output
Posted by: Paul
Date: April 28, 2006 01:14AM

Hi all,

I am using mysql on a php page of mine. The sql statement that I am having trouble with is soppose to return the current day. I get a mysql error when the code executes. I can't figure out why the sql statement produces an error. When I test the sql statement in a copy of mysql I have on my computer (mysql version 5.0.18) it works but when I put it on my webserver it doesn't work (mysql server version unknown). Below is the error and the code.

Error:
Query2 Failed: You have an error in your SQL syntax near '(curdate())' at line 1

and here is the code that corresponds to the error:

$query1 = mysql_query("SELECT months FROM Month WHERE m_id = month(curdate())") or die("Query1 Failed: " . mysql_error()) ;
$query2 = mysql_query("SELECT dayNum FROM Days WHERE dayNum = day(curdate())") or die("Query2 Failed: " . mysql_error()) ;
$query3 = mysql_query("SELECT year FROM Year WHERE year = year(curdate())")or die("Query3 Failed: " . mysql_error()) ;


$query1_data = mysql_fetch_assoc($query1);
$query2_data = mysql_fetch_assoc($query2);

Any help would be appreciated.

Paul

Options: ReplyQuote


Subject
Written By
Posted
Mysql query will not output
April 28, 2006 01:14AM
April 28, 2006 04:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.