unemployment Posted March 15, 2011 Share Posted March 15, 2011 The timestampdiff() fails. #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(MINUTE, `transactions`.`buy_date`, `transactions`.`end_date`) AS `time_left` ' at line 4 $sql = "SELECT `transactions`.`buy_date`, `transactions`.`end_date` TIMESTAMPDIFF(MINUTE, `transactions`.`buy_date`, `transactions`.`end_date`) AS `time_left` FROM `transactions` WHERE `transactions`.`uid` = '${user_info["uid"]}'"; Link to comment https://forums.phpfreaks.com/topic/230758-timestampdiff/ Share on other sites More sharing options...
The Little Guy Posted March 16, 2011 Share Posted March 16, 2011 you need a comma after: `transactions`.`end_date` Link to comment https://forums.phpfreaks.com/topic/230758-timestampdiff/#findComment-1188058 Share on other sites More sharing options...
unemployment Posted March 16, 2011 Author Share Posted March 16, 2011 Good catch, but it still doesn't work. I have...It still fails on the TIMEDIFF line. $sql = "SELECT `transactions`.`buy_date`, `transactions`.`end_date`, TIMEDIFF(`transactions`.`buy_date`, `transactions`.`end_date`) AS `time_left` FROM `transactions` WHERE `transactions`.`uid` = '${user_info["uid"]}'"; Link to comment https://forums.phpfreaks.com/topic/230758-timestampdiff/#findComment-1188112 Share on other sites More sharing options...
Pikachu2000 Posted March 16, 2011 Share Posted March 16, 2011 What is the data type of the two fields you're trying to compare? Link to comment https://forums.phpfreaks.com/topic/230758-timestampdiff/#findComment-1188290 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.