EchoFool Posted April 19, 2010 Share Posted April 19, 2010 I have a query which checks a timestamp to "NOW()" but it returns nothing.. i echo it and i get nothing , yet with error reporting on it doesn't give me undefined error :S This is what i got: LastAction - 0000-00-00 00:00:00 -Timestamp format SELECT *, TIMESTAMPDIFF(MINUTE,'NOW()','LastAction') AS MinutesAgo FROM ".tablename().".user_data WHERE UserID='$UserID' Then i echo it later on : $row = mysql_fetch_assoc($SELECT); Echo 'Minutes ago: '.$row['MinutesAgo'];Echo '<br>'; Echo 'Username: '.$row['Username']; Echo '<br>'; The return gives: Minutes ago: Username: Username1 Any idea why this is happening? Quote Link to comment https://forums.phpfreaks.com/topic/199048-query-not-returning-value/ Share on other sites More sharing options...
PFMaBiSmAd Posted April 19, 2010 Share Posted April 19, 2010 Both NOW() and LastAction are not strings. Why are they enclosed in single-quotes in the query? Quote Link to comment https://forums.phpfreaks.com/topic/199048-query-not-returning-value/#findComment-1044806 Share on other sites More sharing options...
EchoFool Posted April 19, 2010 Author Share Posted April 19, 2010 I was given the query from a user on phpfreaks a while ago - so i assumed that was how they are typed ... Quote Link to comment https://forums.phpfreaks.com/topic/199048-query-not-returning-value/#findComment-1044835 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.