Your problem is this:
$result_row[] = mysql_query($query) or die(mysql_error());
...you are assigning a query to a variable. What you need to do is something like this: $result = mysql_query($query) or die(mysql_error()); while ($result_row = mysql_fetch_array($result)) { ..... }