这是我出现问题的代码: <?php
$conn=mysql_connect("localhost","root","614510")or die("数据库服务器连接错误".mysql_error());
mysql_select_db("message",$conn)or die("数据库访问错误".mysql_error());
mysql_query("set names gb2312");
$keyword=isset($_POST['txt_keyword'])?$_POST['txt_keyword']:'';
$sql=mysql_query("select *from aaa where title like '%keyword%' or content like '%keyword%'");
$row=mysql_fetch_object($sql);
if(!$row){
echo "<font color='red'>您搜索的信息不存在,请使用类似的关键字进行检索!</font>";
}
do{
?>
<tr>
<td><?php echo $row->title;?></td>
<td><?php echo $row->content;?></td>
<td height="30"> </td>
</tr>
<?php
}while($row=mysql_fetch_object($sql));
mysql_free_result($sql);
mysql_close($conn);
?>出现的错误提示是:Notice: Trying to get property of non-object in E:\php\phpnow\htdocs\talking\message-select.php on line 98
$conn=mysql_connect("localhost","root","614510")or die("数据库服务器连接错误".mysql_error());
mysql_select_db("message",$conn)or die("数据库访问错误".mysql_error());
mysql_query("set names gb2312");
$keyword=isset($_POST['txt_keyword'])?$_POST['txt_keyword']:'';
$sql=mysql_query("select *from aaa where title like '%keyword%' or content like '%keyword%'");
$row=mysql_fetch_object($sql);
if(!$row){
echo "<font color='red'>您搜索的信息不存在,请使用类似的关键字进行检索!</font>";
}
do{
?>
<tr>
<td><?php echo $row->title;?></td>
<td><?php echo $row->content;?></td>
<td height="30"> </td>
</tr>
<?php
}while($row=mysql_fetch_object($sql));
mysql_free_result($sql);
mysql_close($conn);
?>出现的错误提示是:Notice: Trying to get property of non-object in E:\php\phpnow\htdocs\talking\message-select.php on line 98
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货