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 Quote Link to comment 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. Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
DaveLinger Posted February 11, 2008 Author Share Posted February 11, 2008 gives me a syntax error. Quote Link to comment 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.... Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.