onthespot Posted August 4, 2009 Share Posted August 4, 2009 Can anyone see the problem here... $name=mysql_real_escape_string($_GET['comp']); $res=mysql_query("SELECT * FROM leaguecomments WHERE comp_name = '$name' ORDER BY date DESC"); while($row=mysql_fetch_assoc($res)){ $user=$row['user']; $comment=$row['comment']; $commentdate=$row['date']; $date=strtotime($commentdate); $final_date=date("g:i a", $date); $final_date2=date("F j Y", $date); mysql_fetch_assoc(): supplied argument is not a valid MySQL I can't work it out? Link to comment https://forums.phpfreaks.com/topic/168821-solved-while-error/ Share on other sites More sharing options...
TeNDoLLA Posted August 4, 2009 Share Posted August 4, 2009 Probably your mysql_query is failing add mysql_error to see if thats the case: $res=mysql_query("SELECT * FROM leaguecomments WHERE comp_name = '$name' ORDER BY date DESC") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/168821-solved-while-error/#findComment-890705 Share on other sites More sharing options...
watsmyname Posted August 4, 2009 Share Posted August 4, 2009 Can anyone see the problem here... $name=mysql_real_escape_string($_GET['comp']); $res=mysql_query("SELECT * FROM leaguecomments WHERE comp_name = '$name' ORDER BY date DESC"); while($row=mysql_fetch_assoc($res)){ $user=$row['user']; $comment=$row['comment']; $commentdate=$row['date']; $date=strtotime($commentdate); $final_date=date("g:i a", $date); $final_date2=date("F j Y", $date); mysql_fetch_assoc(): supplied argument is not a valid MySQL I can't work it out? might be your query returned 0 record, you should check whether there are any records or not and if there are records then use loop to display. Link to comment https://forums.phpfreaks.com/topic/168821-solved-while-error/#findComment-890706 Share on other sites More sharing options...
onthespot Posted August 4, 2009 Author Share Posted August 4, 2009 Sorry was a simple error, sorted Link to comment https://forums.phpfreaks.com/topic/168821-solved-while-error/#findComment-890707 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.