hmm. instead of
if ($result != '')
try
if (mysql_affected_rows() || die("No results returned")){
while ($row = mysql_fetch_row($result)){
//prcess row here
//use this just to see if your getting actual values returned
//then remove it and process the rows if you are getting actual values
foreach($row as $key => $value){
echo "$key = $value<BR>";
}
}
I am guessing that you are not getting data returned in the result, or are getting a nul value returned.
You can get a valid $result returned, without actually retrieveing any data.
If this is the case, mysql_affected_rows() will return false and the die() statement will execute.