真烦人未定义的变量错误[重复]

So I have the following code

$query=mysql_query("SELECT * FROM `phones` JOIN manufacturer USING (ManufacturerID) JOIN operatingsystem USING (OSID) WHERE PhoneID=$id");
$row=mysql_fetch_object($query);
echo mysql_error();

while($row=mysql_fetch_array($result))
{ ?>
<div class="phones">
<?php
echo "<img src=\"images/phones/".$row['LargeImg']."\"/>";
echo "<h2>";
echo "$row->Name $row->Model";
echo "</h2>";
echo "<p>";
echo "<ul>";
echo "<li>Running $row->OSName</li>";
echo "<br />";
echo "<li>$row->ScreenSize Display</li>";
echo "<br />";
echo "<li>$row->StorageSize of Storage</li>";
echo "</p>";
echo "</ul>";
?>
</div>
<?php
}
mysql_close($con);
?>

I get the error Notice: Undefined variable: result in phone-details.php on line 43 Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in phone-details.php on line 43

What I want it to do is display an image next to the details of the product (Product details were working before but then I tried to get the image working and it broke). The filename is stored in a field named LargeImg and the image file itself is stored in the images/phones folder. How will I fix this so the error is gone and the images display for each record in the database? The simpler the code the better.

Thanks.

</div>

use the $query variable as the parameter for mysql_fetch_array. The parameter has to be a mysql_query reference.

$result is never defined here..

$row=mysql_fetch_object($query);
echo mysql_error();

while($row=mysql_fetch_array($result))

Regardless of the speaches you will get about using mysql_* functions. $result is not defined. It holds nothing. Usualy people used to do something like:

$result = mysql_query("QUERY");
while($row=mysql_fetch_array($result)){
//do stuff
}

You are mixing up your functions my friend. Also please don't use mysql_* functions as they are deprecated! :)