almightyegg Posted April 14, 2009 Share Posted April 14, 2009 I have this code if($gauge == TRUE){ $timestamp = date("Y-m-d H:i:s"); $d2 = strtotime($timestamp); $info .= " and strtotime(`gauge`) > '$d2'"; } $info becomes this big long string and is like this: $info = "SELECT * FROM users WHERE$info"; $sel = mysql_query("$info") or die(mysql_error()); Problem is, I'm not sure how to do the strtotime() to the table variable. it's reading it a a column heading: FUNCTION lordofth_game.strtotime does not exist Any help on how to get it to work would be greatly received Link to comment https://forums.phpfreaks.com/topic/154015-solved-strtotime-in-a-query/ Share on other sites More sharing options...
Mchl Posted April 14, 2009 Share Posted April 14, 2009 MySQL doesn't have STRTOTIME function. What type is the `gauge` field? Link to comment https://forums.phpfreaks.com/topic/154015-solved-strtotime-in-a-query/#findComment-809594 Share on other sites More sharing options...
almightyegg Posted April 14, 2009 Author Share Posted April 14, 2009 timestamp Link to comment https://forums.phpfreaks.com/topic/154015-solved-strtotime-in-a-query/#findComment-809624 Share on other sites More sharing options...
Mchl Posted April 14, 2009 Share Posted April 14, 2009 Then this should work if($gauge == TRUE){ $info .= " and `gauge` > NOW()"; } Link to comment https://forums.phpfreaks.com/topic/154015-solved-strtotime-in-a-query/#findComment-809628 Share on other sites More sharing options...
almightyegg Posted April 14, 2009 Author Share Posted April 14, 2009 That was an epic fail by me :S cheers Link to comment https://forums.phpfreaks.com/topic/154015-solved-strtotime-in-a-query/#findComment-809642 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.