abstract:新增新增
prepare($sql); //var_dump($stmt); # 参数绑定 $name = 'Monkey'; $email = 'Monkey@qq.com'; $password = sha1(123123); $status = 0; $create_time = time(); $stmt->bindParam(':name', $name, PDO::PARAM_STR, 20); $stmt->bindParam(':email', $email, PDO::PARAM_STR, 100); $stmt->bindParam(':password', $password, PDO::PARAM_STR, 128); $stmt->bindParam(':status', $status, PDO::PARAM_INT, 1); $stmt->bindParam(':create_time', $create_time, PDO::PARAM_INT, 10); if($stmt->execute()){ echo $stmt->rowCount(); }else{ exit(print_r($stmt->errorInfo(), true)); }更新
prepare($sql); //var_dump($stmt); # 参数绑定 $id = 3; $email = 'Jhon@126.com'; $status = 0; $create_time = time(); $stmt->bindParam(':id', $id, PDO::PARAM_INT, 11); $stmt->bindParam(':email', $email, PDO::PARAM_STR, 100); $stmt->bindParam(':status', $status, PDO::PARAM_INT, 1); $stmt->bindParam(':create_time', $create_time, PDO::PARAM_INT, 10); if($stmt->execute()){ echo $stmt->rowCount(); }else{ exit(print_r($stmt->errorInfo(), true)); }删除
prepare($sql_2); //var_dump($stmt); # 参数绑定 $id = 2; $num = 1; $stmt->bindParam(':id', $id, PDO::PARAM_INT, 11); $stmt->bindParam(':num', $num, PDO::PARAM_INT, 1); if($stmt->execute()){ echo '已删除 '.$stmt->rowCount().' 条记录'; }else{ exit(print_r($stmt->errorInfo(), true)); }Correcting teacher:查无此人Correction time:2019-05-05 09:32:54
Teacher's summary:完成的不错。php最多的就是对数据库进行操作。继续加油。