timmah1 Posted December 3, 2008 Share Posted December 3, 2008 Why is this giving my the error Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /usr/home/thegr418/public_html/core/test.php on line 15 I see this and I automatically think that the database connection isn't correct, but everything is correct, and there are items in the table Here is the code $q = "SELECT * FROM blogs ORDER BY rand(".date('d').") LIMIT 5" or die("There is a problem selecting the blogs ".mysql_error()); $a = mysql_fetch_assoc($q); Thanks in advance Link to comment https://forums.phpfreaks.com/topic/135370-solved-select-error/ Share on other sites More sharing options...
rhodesa Posted December 3, 2008 Share Posted December 3, 2008 you forgot mysql_query() $q = mysql_query("SELECT * FROM blogs ORDER BY rand(".date('d').") LIMIT 5") or die("There is a problem selecting the blogs ".mysql_error()); $a = mysql_fetch_assoc($q); Link to comment https://forums.phpfreaks.com/topic/135370-solved-select-error/#findComment-705092 Share on other sites More sharing options...
timmah1 Posted December 3, 2008 Author Share Posted December 3, 2008 OMG! (i feel stupid) Link to comment https://forums.phpfreaks.com/topic/135370-solved-select-error/#findComment-705096 Share on other sites More sharing options...
rhodesa Posted December 3, 2008 Share Posted December 3, 2008 OMG! (i feel stupid) we all have our days Link to comment https://forums.phpfreaks.com/topic/135370-solved-select-error/#findComment-705098 Share on other sites More sharing options...
timmah1 Posted December 3, 2008 Author Share Posted December 3, 2008 Thanks rhodesa Link to comment https://forums.phpfreaks.com/topic/135370-solved-select-error/#findComment-705103 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.