前端之家收集整理的这篇文章主要介绍了
php查询及多条件查询,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_301_0@单条件查询:
@H_
301_0@1.先要有一张表,
显示出表中的数据:
<div class="jb51code">
<pre class="brush:
PHP;">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
无标题文档
分组</tr>
<?php
$db = new mysqli("localhost","root","12345678","heiheihei");
$sql = "select * from contacts";
$r = $db->query($sql);
//传值
while ($attr = $r->fetch_row())
{
echo " <tr>
<td>{$attr[0]}</td>
<td>{$attr[1]}</td>
<td>{$attr[2]}</td>
<td>{$attr[3]}</td>
</tr>";
}
?>
</table>