Nothing is wrong with your script.
I assume you want to traverse your result array. This would be something like:
I have a little tool function using mysql_result($r,m,n), where
$r:Result array
$m: Column
$n: Row
Make a double loop, and display the output as HTML.
Make yourself a little toolbox for displaying sql statements etc, and you will prosper as a programmer.
Nice and simple.