Your MySQL query is not the correct syntax. Could you post that?
After you run a query, it is a good idea to test to make sure it ran as expected. Try something like this:
$myquery = "SELECT id, name FROM mytable";
$result = mysql_query($myquery);
if(!$result) echo "error in query: \"".$myquery."\" -- ".mysql_error();
$array = mysql_fetch_array($result);