前面用连接能正确显示数据,但是对sql1的查询始终报错,报错出现在最后一行
if($row1 = mysql_fetch_row($result1));
单独进行前面一个或者后面一个都能正确显示结果,但是因为第二个查询需要第一的的结果作为条件,所以写在一起后就不行了错误是:Fatal error: Call to a member function fetch_row() on a non-object in D:\wampserver\wamp\www\LAF\xunwu_Msg.php on line 116
代码(省略了部分布局代码)<?php
$msgID = $_GET['msgID'];
$conn = mysql_connect("localhost", "root", "469201743");
    if (!$conn)
    {
       die('Could not connect: ' . mysql_error());
    }
    $db_selected = mysql_select_db("my_db",$conn);
    mysql_query('set names gb2312');
$sql= "SELECT msgID,title,pic,reletime,description,place,dplace,date,username FROM lostMsg WHERE msgID= $msgID ORDER BY msgID DESC";
    $result= mysql_query($sql,$conn);
$name =$row[8];
    if($row = mysql_fetch_row($result))
?>
<div id="picture">
<img src =" <?php echo $row[2];?>" height ="180" width="180" />

</div>
&nbsp;&nbsp;&nbsp信息标题:<?php echo $row[1];?><br/><br/>
&nbsp;&nbsp;&nbsp发布时间:<?php echo $row[3];?><br/>
&nbsp;<div style="font-size: 12pt;font-weight: bold ;">基本资料</div></br>
 &nbsp;&nbsp;&nbsp详细描述:<?php echo $row[4];?><br/><br/>
&nbsp;<div style="font-size: 12pt;font-weight: bold ;">丢失地点</div></br>
 &nbsp;&nbsp;&nbsp所属区域:<?php echo $row[5];?><br/><br/>
 &nbsp;&nbsp;&nbsp详细地点:<?php echo $row[6];?><br/><br/>
 &nbsp;<div style="font-size: 12pt;font-weight: bold ;">丢失时间</div><?php echo $row[7];?></br>
&nbsp;<div style="font-size: 12pt;font-weight: bold ;">联系方式</div></br>
   
<?php $sql1= "SELECT username,phone,qq,email FROM user WHERE username = $name";

$result1= mysql_query($sql1,$conn);

    if($row1 = mysql_fetch_row($result1))
     
?>
 
 &nbsp;&nbsp;&nbsp联系人:<?php echo $row1[0];?><br/><br/>
 &nbsp;&nbsp;&nbsp手机:<?php echo $row1[1];?><br/><br/>
 &nbsp;&nbsp;&nbsp QQ:<?php echo $row1[2];?><br/><br/>
 &nbsp;&nbsp;&nbsp  邮箱:<?php echo $row1[3];?><br/><br/>
</div>执行结果