flemingmike Posted March 20, 2009 Share Posted March 20, 2009 here is my code, it doesnt work though: mysql_query("DELETE FROM findamatch WHERE NOW() - 3 HOUR > $timestamp"); Quote Link to comment https://forums.phpfreaks.com/topic/150336-my-mysql_query-doesnt-work/ Share on other sites More sharing options...
Maq Posted March 20, 2009 Share Posted March 20, 2009 mysql_query("DELETE FROM findamatch WHERE NOW() - 3 HOUR > $timestamp") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/150336-my-mysql_query-doesnt-work/#findComment-789531 Share on other sites More sharing options...
flemingmike Posted March 20, 2009 Author Share Posted March 20, 2009 i get this error now: 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 'HOUR > 1237561603' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/150336-my-mysql_query-doesnt-work/#findComment-789535 Share on other sites More sharing options...
Mchl Posted March 20, 2009 Share Posted March 20, 2009 NOW() - 3 HOUR is not correct MySQL syntax Try NOW() - 030000 Quote Link to comment https://forums.phpfreaks.com/topic/150336-my-mysql_query-doesnt-work/#findComment-789540 Share on other sites More sharing options...
flemingmike Posted March 20, 2009 Author Share Posted March 20, 2009 i tried that, it just removed all the entries though, even new ones. here is the format of my timestamp 2009-03-20 10:28:26 here is my code: mysql_query("DELETE FROM findamatch WHERE NOW() - 030000 > $timestamp") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/150336-my-mysql_query-doesnt-work/#findComment-789562 Share on other sites More sharing options...
revraz Posted March 20, 2009 Share Posted March 20, 2009 You don't specify what FIELD your timestamp is in. Quote Link to comment https://forums.phpfreaks.com/topic/150336-my-mysql_query-doesnt-work/#findComment-789567 Share on other sites More sharing options...
flemingmike Posted March 20, 2009 Author Share Posted March 20, 2009 $fam=mysql_query("SELECT id,clan,rules,month,day4,year,hour,min,ampm,timezone,teamid,ladder,maxbet,aim,email,yim,timestamp FROM findamatch ORDER BY timestamp"); while(list($id,$clan,$rules,$month,$day4,$year,$hour,$min,$ampm,$timezone,$teamid,$ladder,$maxbet,$aim,$email,$yim,$timestamp)=mysql_fetch_row($fam)){ Quote Link to comment https://forums.phpfreaks.com/topic/150336-my-mysql_query-doesnt-work/#findComment-789568 Share on other sites More sharing options...
flemingmike Posted March 20, 2009 Author Share Posted March 20, 2009 anyone have any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/150336-my-mysql_query-doesnt-work/#findComment-789622 Share on other sites More sharing options...
Mchl Posted March 20, 2009 Share Posted March 20, 2009 Maybe. Just write what you want to achieve actually. Quote Link to comment https://forums.phpfreaks.com/topic/150336-my-mysql_query-doesnt-work/#findComment-789713 Share on other sites More sharing options...
Maq Posted March 20, 2009 Share Posted March 20, 2009 $fam=mysql_query("SELECT id,clan,rules,month,day4,year,hour,min,ampm,timezone,teamid,ladder,maxbet,aim,email,yim,timestamp FROM findamatch ORDER BY timestamp"); while(list($id,$clan,$rules,$month,$day4,$year,$hour,$min,$ampm,$timezone,$teamid,$ladder,$maxbet,$aim,$email,$yim,$timestamp)=mysql_fetch_row($fam)){ No one knows what this is or what it is supposed to do, nor can we read that. Quote Link to comment https://forums.phpfreaks.com/topic/150336-my-mysql_query-doesnt-work/#findComment-789718 Share on other sites More sharing options...
revraz Posted March 20, 2009 Share Posted March 20, 2009 What field name do you want the Delete based on? What does $timestamp variable contain? If you echo the query, what does it look like? Quote Link to comment https://forums.phpfreaks.com/topic/150336-my-mysql_query-doesnt-work/#findComment-789746 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.