DaveLinger Posted February 11, 2008 Share Posted February 11, 2008 Here's what IS working: SELECT *, UNIX_TIMESTAMP(`starttime`) as starttime FROM wrlf_auction_config ORDER BY datetime DESC LIMIT 1 however, I also need to select endtime as a unix timestamp, and don't know how to tell it multiple things. For example, this doesn't work: SELECT *, UNIX_TIMESTAMP(`starttime`) as starttime, UNIX_TIMESTAMP(`endtime`) as endtime, FROM wrlf_auction_config ORDER BY datetime DESC LIMIT 1 Link to comment https://forums.phpfreaks.com/topic/90535-mysql-syntax-help/ Share on other sites More sharing options...
frijole Posted February 11, 2008 Share Posted February 11, 2008 you have to say where you are selecting from, ie which DB. and you don't need all the commas. Link to comment https://forums.phpfreaks.com/topic/90535-mysql-syntax-help/#findComment-464152 Share on other sites More sharing options...
DaveLinger Posted February 11, 2008 Author Share Posted February 11, 2008 I define which DB I'm selecting from in the connection code... as I said, the first code works, just not the second. So connection is not an issue, nor are commas. Link to comment https://forums.phpfreaks.com/topic/90535-mysql-syntax-help/#findComment-464154 Share on other sites More sharing options...
revraz Posted February 11, 2008 Share Posted February 11, 2008 What do you mean by "doesn't work"? Does it error or not give you the result you expect? Link to comment https://forums.phpfreaks.com/topic/90535-mysql-syntax-help/#findComment-464155 Share on other sites More sharing options...
DaveLinger Posted February 11, 2008 Author Share Posted February 11, 2008 gives me a syntax error. Link to comment https://forums.phpfreaks.com/topic/90535-mysql-syntax-help/#findComment-464156 Share on other sites More sharing options...
revraz Posted February 11, 2008 Share Posted February 11, 2008 So I guess you're going to make me ask you to post the error.... Link to comment https://forums.phpfreaks.com/topic/90535-mysql-syntax-help/#findComment-464158 Share on other sites More sharing options...
DaveLinger Posted February 11, 2008 Author Share Posted February 11, 2008 Never seen a generic SQL Syntax error before? Problem with the querySELECT *, UNIX_TIMESTAMP(`starttime`) as starttime, UNIX_TIMESTAMP(`endtime`) as endtime, FROM wrlf_auction_config ORDER BY datetime DESC LIMIT 1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM wrlf_auction_config ORDER BY datetime DESC LIMIT 1' at line 1 Link to comment https://forums.phpfreaks.com/topic/90535-mysql-syntax-help/#findComment-464161 Share on other sites More sharing options...
DaveLinger Posted February 11, 2008 Author Share Posted February 11, 2008 looks like I had one too many commas, removed the one before "FROM" and it works Solved. Link to comment https://forums.phpfreaks.com/topic/90535-mysql-syntax-help/#findComment-464163 Share on other sites More sharing options...
revraz Posted February 11, 2008 Share Posted February 11, 2008 No such thing as a "Generic Syntax Error". With that error, its telling you exactly where the error is. Never seen a generic SQL Syntax error before? Problem with the querySELECT *, UNIX_TIMESTAMP(`starttime`) as starttime, UNIX_TIMESTAMP(`endtime`) as endtime, FROM wrlf_auction_config ORDER BY datetime DESC LIMIT 1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM wrlf_auction_config ORDER BY datetime DESC LIMIT 1' at line 1 Link to comment https://forums.phpfreaks.com/topic/90535-mysql-syntax-help/#findComment-464166 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.