Okay. let's look at your code (that's always a good place to start when your code doesn't work :>)
You fetch the row as an array, implode it into $result, then explode it into $item. Why?
Then you create an empty array as $array and loop through every element of it. That shouldn't take long since $array is empty...
Anyway, you get an array from the call to mysql_fetch_row, just use in instead of the useless implode/explode/for loop:
$result = mysql_fetch_row($query);
print_r($result);