Did you notice that you lost the $result object initially retrieved from the database? In this line:
$result = mysql_fetch_array($result);
What would you expect if you are not using all the data set. Please see the documentation:
http://php.net/manual/en/function.mysql-fetch-array.php[
^].
Pay attention that it "Returns an array that corresponds to the fetched row and moves the internal data pointer ahead". That said, if you can this function again, you will get another row, so you can do it in cycle until you get FALSE in return (please see "Return Values"). But you cannot do it because you lost $result object returned from the call to
mysql_query
. Just introduce another variable:
$row = mysql_fetch_array($result);
You may have other bugs, this is just the first apparent one.
—SA