Re: [PHP-DB] Any idea what's wrog with this query?

2002-04-18 Thread Paul Edmondson


see http://www.mysql.com/doc/R/e/Reserved_words.html

Your column called 'when' is a reserved word.
Thats my first guess at your problem. I've come across this before with
MySQL accepting column names that are reserved words. Try changing the
column name to something else and try again.


On Thu, 2002-04-18 at 18:34, Leif K-Brooks wrote:
 I have a field in one of my tables called when, which is type timestamp.
 I'm trying to use some of the date functions to get data from it, but it's
 not working.  The return from mysql_error() is not helpful.  Any ideas?
 Here's my query:
 $query = mysql_query(select month(when) as month,year(when) as
 year,dayofmonth(when) as day,hour(when) as hour,minute(when) as
 minute,second(when) as second from table) or print Error: .mysql_error(); 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
-- 

Paul Edmondson, Software Engineer
Yospace: Creating Value for Wireless
7 The Courtyard, High Street, Staines, UK, TW18 4DR
Tel: +44 1784 466388
Fax: +44 1784 466387
http://www.yospace.com




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Any idea what's wrog with this query?

2002-04-18 Thread Leif K-Brooks

It worked, thanks alot!
on 4/18/02 1:43 PM, Paul Edmondson at [EMAIL PROTECTED] wrote:


see http://www.mysql.com/doc/R/e/Reserved_words.html

Your column called 'when' is a reserved word.
Thats my first guess at your problem. I've come across this before with
MySQL accepting column names that are reserved words. Try changing the
column name to something else and try again.


On Thu, 2002-04-18 at 18:34, Leif K-Brooks wrote:
 I have a field in one of my tables called when, which is type timestamp.
 I'm trying to use some of the date functions to get data from it, but it's
 not working.  The return from mysql_error() is not helpful.  Any ideas?
 Here's my query:
 $query = mysql_query(select month(when) as month,year(when) as
 year,dayofmonth(when) as day,hour(when) as hour,minute(when) as
 minute,second(when) as second from table) or print Error: .mysql_error();
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php