Jump to content

[SOLVED] Help with a sql query -- not valid resource


RyanSF07

Recommended Posts

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>";
}

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());

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.