我编写的代码允许我使用旧代码 mysql 从 mysql 获取信息,我尝试从 mysql 更改为 mysqli,但有些方法无法正常工作,我相信我仍然是学习 mysqli 的新手,可以一个帮助我从mysql写入mysqli,这样我就可以从那里学习自己......这是代码......
谢谢...
<?php
include('db.php');
?>
<?php
if(isset($_POST['kw']) && $_POST['kw'] != '')
{
$kws = $_POST['kw'];
$kws = mysql_real_escape_string($kws);
$query = "select * from product where product_name like '%".$kws."%' limit 10" ;
$res = mysql_query($query);
$count = mysql_num_rows($res);
$i = 0;
if($count > 0)
{
echo "<ul>";
while($row = mysql_fetch_array($res))
{
echo "<a href='$row[product_name]'><li>";
echo "<div id='rest'>";
echo $row['product_name'];
echo "<br />";
echo "<td>";?><img src="<?php echo $row["screenshot"];?>" height="100" width="100" <?php echo "</td>" ;
echo "</div>";
echo "<div style='clear:both;'></div></li></a>";
$i++;
if($i == 5) break;
}
echo "</ul>";
if($count > 5)
{
echo "<div id='view_more'><a href='#'>View more results</a></div>";
}
}
else
{
echo "<div id='no_result'>No result found !</div>";
}
}
?>