Reply
Whats wrong with this query ???
Old 02-24-2005, 07:08 AM Whats wrong with this query ???
Novice Talker

Posts: 8
can anyone tell me what is wrong with this query


$time=time();
$timeout = $time - 1200;

mysql_query("delete from ut_temp where time<$timeout") or die('Error In Deletion of Temp Value');
Extreme43 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 02-24-2005, 10:10 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
First try putting $timeout in single quotes, but failing that replace 'Error in deletion of Temp Value' with mysql_error(), and it will tell you what's wrong!
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';
Scribble Pad MOD for phpBB (aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 02-24-2005, 08:04 PM
Christopher's Avatar
Iced Cap

Posts: 3,111
Location: Toronto, Ontario
As I said at DBF...

I'm thinking it's because of your "time" field. "time" is a mySQL keyword, so if you want to use it as a field name, you must enclose it in backticks.

Also, try add the mysql error message to your die() so you know what is going on next time.

Code:
mysql_query("delete from ut_temp where `time` < $timeout") or die('Error In Deletion of Temp Value - Error: ' . mysql_error());
Christopher is offline
Reply With Quote
View Public Profile Visit Christopher's homepage!
 
Reply     « Reply to Whats wrong with this query ???
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12135 seconds with 12 queries