die('') 终止当前php文件的执行,并且向客户端输出一个终止原因说明.@ 压制住当前行代码警告消息.
time() 返回当前系统时间,以秒为消息的整数
$id = mysqli_insert_id($conn);返回连接上刚刚执行insert语句产生自增编号.
$size = mysqli_affected_rows($conn);返回连接上刚执行增删改语句影响行数
mysqli_fetch_all($result,MYSQLI_ASSOC);从查询结果集中抓取所有记录,并且返回二维数组.
例子:
<?php //echo "1<br/>"; //die('当前程序出现故障'); //终止当前php运行 //echo "2<br/>"; //@$id = $_REQUEST['nid']; //echo $id; $conn = mysqli_connect('127.0.0.1','root','','bbs'); $sql = "INSERT INTO user VALUES(null,'a','a','1.jpg',0,now())"; $result = mysqli_query($conn,$sql); if($result===true){ $id = mysqli_insert_id($conn); echo '新增记录编号是'.$id.'<br />'; $size = mysqli_affected_rows($conn); echo '影响记录数'.$size; } $sql = "SELECT * FROM user"; $result = mysqli_query($conn,$sql); $rows = mysqli_fetch_all($result,MYSQLI_ASSOC); echo "<hr/>"; foreach($rows as $k=>$v){ //echo $k.'<br />'; echo $v['uid'].$v['uname'].$v['pic'].'<br />'; } ?>