Woodsyx Posted September 1, 2009 Share Posted September 1, 2009 Hey just wondering if I could get some help with this error. I had the exact same lines of code up to that point in a previous file with no problems and all of a sudden this is showing up. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in ///// on line 51 $result = mysql_query("SELECT lasttime FROM idlers WHERE name='".mysql_real_escape_string($name)."'"); $row = mysql_fetch_array($result); $ptime = $row['lasttime']; Quote Link to comment https://forums.phpfreaks.com/topic/172650-solved-strange-mysql-error-that-wasnt-there-before/ Share on other sites More sharing options...
MadTechie Posted September 1, 2009 Share Posted September 1, 2009 i would say update the line to $result = mysql_query("SELECT lasttime FROM idlers WHERE name='".mysql_real_escape_string($name)."'") or die(mysql_error()); to display the error but your code doesn't contain the line with the error ! mysql_num_rows() isn't in that code! Quote Link to comment https://forums.phpfreaks.com/topic/172650-solved-strange-mysql-error-that-wasnt-there-before/#findComment-910055 Share on other sites More sharing options...
Woodsyx Posted September 1, 2009 Author Share Posted September 1, 2009 Oh whoops I copy pasted the wrong lines of code here is line 50-51 $value = mysql_query("SELECT name FROM idlers WHERE name='".mysql_real_escape_string($name)."' LIMIT 1"); $num_rows = mysql_num_rows($value); Quote Link to comment https://forums.phpfreaks.com/topic/172650-solved-strange-mysql-error-that-wasnt-there-before/#findComment-910409 Share on other sites More sharing options...
MadTechie Posted September 1, 2009 Share Posted September 1, 2009 add or die(mysql_error()); $value = mysql_query("SELECT name FROM idlers WHERE name='".mysql_real_escape_string($name)."' LIMIT 1") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/172650-solved-strange-mysql-error-that-wasnt-there-before/#findComment-910541 Share on other sites More sharing options...
Woodsyx Posted September 1, 2009 Author Share Posted September 1, 2009 Well that was simple turn out I had "" instead of '' around my table var. Thanks for the help and I'll remember to add that bit of code on any problem mysql stuff next time. Quote Link to comment https://forums.phpfreaks.com/topic/172650-solved-strange-mysql-error-that-wasnt-there-before/#findComment-910590 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.