Paul, Try TO_DAYS(curdate()) instead - if not you can't say we didn't try! ;-) If that doesn't work you may want to try a MySQL list. - Joe On 4/3/06, Paul Goepfert <paul.goepfert@xxxxxxxxx> wrote: > > I included the or die function on the end of my query statement. When > I tested this on my web page I got the following error > > Query2 Failed: You have an error in your SQL syntax near '(curdate())' at > line 1 > > When this code executed: > > $query2 = mysql_query("SELECT dayNum FROM Days WHERE dayNum = > day(curdate())") ; > > I can't see where the error is. Can anyone see the error? > > The table name is correct because I have another drop down box that > gets all dates in the table and outputs it with no error. I also > tested the above SQL statement on a local copy of mysql (version > 5.0.18-nt) and it worked with out any errors. And this code works on > a different web server. Mysql client version 3.23.49. However it does > not work on mysql client version 3.23.54. Also both php versions are > the same. > > Thanks > Paul > > On 4/3/06, Jon Drukman <jsd@xxxxxxxxxxxxx> wrote: > > Paul Goepfert wrote: > > > > > function determineDay () > > > { > > > $return = ""; > > > $query1 = mysql_query("SELECT months FROM Month WHERE > m_id = > > > month(curdate())"); > > > $query2 = mysql_query("SELECT dayNum FROM Days WHERE > dayNum = > > > day(curdate())"); > > > $query3 = mysql_query("SELECT year FROM Year WHERE year > = year(curdate())"); > > > > always Always ALWAYS check the error return!!! > > > > $query1 = mysql_query("SELECT months FROM Month WHERE m_id = > > month(curdate())") or die("query1 failed: " . mysql_error()); > > > > do this religiously on every single mysql_query. in fact, write a > > wrapper function to do it for you - that's what i do. > > > > > If anyone can find my error please let me know. I have looked at this > > > for about an hour and I can't figure it out. > > > > you probably could have saved an hour by checking the error code. > > > > -jsd- > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >