RyanSF07 Posted June 3, 2009 Share Posted June 3, 2009 Hi Guys, Why am I getting a "mysql_fetch_array(): supplied argument is not a valid MySQL result resource" error on the below mysql_query? I'm trying to say pull all of the data from the rows in the Scores table were the "teacher_code" in the registered_users table = the teacher_code in the scores table. What I'm I messing up here? Thank you for your help! $content2 .= "<h2>Student Scores listed by assignment #:</h2>"; $data = mysql_query("SELECT * FROM scores, registered_users WHERE registered_users.teacher_code = scores.scores_teacher_code" ORDER BY assignment_number ASC") or die(mysql_error()); $query_result2 = mysql_query($data); while ($row = mysql_fetch_array($query_result2)) $content3 .= " <tr><td><p>".$row['assignment_number']."</td><td>". $row['my_name'] ."</td><td>".$row['my_score'] . " out of " . $row['total'] . "</td> <td></a> <a href = \"my_account_delete_this_assingment.php?delete_assingment_id=$row[assingment_number]\ onClick=\"return confirm('Are you sure you want to delete all of the results from this assingment? This action cannot be undone.');\">[Delete]</a></p></td></tr>"; } Link to comment https://forums.phpfreaks.com/topic/160847-solved-help-with-a-sql-query-not-valid-resource/ Share on other sites More sharing options...
RyanSF07 Posted June 3, 2009 Author Share Posted June 3, 2009 I've also tried: $data = mysql_query("SELECT registered_users.teacher_code, scores.assignment_number, scores.my_name, scores.my_score, scores.total FROM scores, registered_users WHERE registered_users.teacher_code = scores.scores_teacher_code") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/160847-solved-help-with-a-sql-query-not-valid-resource/#findComment-848885 Share on other sites More sharing options...
RyanSF07 Posted June 3, 2009 Author Share Posted June 3, 2009 was a syntax thing -- finally got it sorted. Link to comment https://forums.phpfreaks.com/topic/160847-solved-help-with-a-sql-query-not-valid-resource/#findComment-848903 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.