leequalls Posted October 25, 2010 Share Posted October 25, 2010 Not sure what I am doing wrong: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /public_html/lq/index.php on line 12 $schedule = "LQ"; include('/public_html/en/header_staff.php'); include("connect.php"); $page = $_SERVER["SERVER_NAME"]; $who = explode(".", $page); $sql = "select * from rp_staff WHERE schedule = $schedule"; $rpstaff = mysql_query($sql); while ($row = mysql_fetch_assoc($rpstaff)) { $alt = $row['dj']; $name = $row['name']; $city = $row['city']; $state = $row['state']; $country = $row['country']; $artists = $row['artists']; $about = $row['about']; $genre = $row['genrev']; $position = $row['position']; } Link to comment https://forums.phpfreaks.com/topic/216744-mysql_fetch_assoc/ Share on other sites More sharing options...
revraz Posted October 25, 2010 Share Posted October 25, 2010 Your SQL is failing, so your $rpstaff variable is empty. Try to use error checking on all querries, it will save you headaches. $rpstaff = mysql_query($sql) or die ('Error in query: $sql. ' . mysql_error()); Link to comment https://forums.phpfreaks.com/topic/216744-mysql_fetch_assoc/#findComment-1126021 Share on other sites More sharing options...
leequalls Posted October 25, 2010 Author Share Posted October 25, 2010 thanks here is the error Error in query: $sql. Unknown column 'LQ' in 'where clause' Link to comment https://forums.phpfreaks.com/topic/216744-mysql_fetch_assoc/#findComment-1126026 Share on other sites More sharing options...
Pikachu2000 Posted October 25, 2010 Share Posted October 25, 2010 WHERE schedule = '$schedule'"; Link to comment https://forums.phpfreaks.com/topic/216744-mysql_fetch_assoc/#findComment-1126027 Share on other sites More sharing options...
leequalls Posted October 25, 2010 Author Share Posted October 25, 2010 thanks for the help that was a silly fix Link to comment https://forums.phpfreaks.com/topic/216744-mysql_fetch_assoc/#findComment-1126029 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.