acctman Posted July 29, 2009 Share Posted July 29, 2009 is there a reason why this query is not work err: PHP Warning: mysql_result(): supplied argument is not a valid MySQL result resource in ... $date = mysql_result(mysql_query("SELECT m_date, m_id FROM rate_members WHERE m_id=$id"), 0, "m_date"); Quote Link to comment https://forums.phpfreaks.com/topic/167885-solved-query-not-working/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 29, 2009 Share Posted July 29, 2009 Add the following right after that line to find out why the query failed - echo mysql_error(); Quote Link to comment https://forums.phpfreaks.com/topic/167885-solved-query-not-working/#findComment-885495 Share on other sites More sharing options...
BLaZuRE Posted July 29, 2009 Share Posted July 29, 2009 is there a reason why this query is not work err: PHP Warning: mysql_result(): supplied argument is not a valid MySQL result resource in ... $date = mysql_result(mysql_query("SELECT m_date, m_id FROM rate_members WHERE m_id=$id"), 0, "m_date"); Yeah .. there's always a reason. Anyway, I'd say save your your mysql_query into a variable, i.e. $result = mysql_query("...");. It makes your code look much cleaner and easier to troubleshoot. That way, you can print out what your query returns and check to see if that's what you want. Another thing that I see in your code: You're querying $id. $id exists in PHP, not MySQL. That's another reason why you should save it as a separate variable. Concatenate your string. You're including the text $id right now, not THE VALUE of $id, which is different. Quote Link to comment https://forums.phpfreaks.com/topic/167885-solved-query-not-working/#findComment-885583 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.