Blogger Information
Blog 14
fans 0
comment 0
visits 8619
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
mysqli面向对象实现更新 20180426 16:39
弗洛加特的博客
Original
490 people have browsed it

实例

<?php

/医院
 *1创建数据库
 * 2准备SQL语句
 * 3创建出预处理对象STMT
 * 4检测STMT,预处理的SQL语句对象
 * 5执行SQL语句
 */

require 'mysqli_connect.php';
$sql = "update ignore staff set salary=? where staff_id=?;";
$stmt = $mysqli->stmt_init();
if($stmt->prepare($sql)){
    $stmt->bind_param('si',$name,$salary);
    $salary=8800;
    $staff_id=17;
    $stmt->execute();
    if($stmt->affected_rows>0){
      echo '<br>插入成功'.$stmt->affected_rows.'条记录,id:'.$stmt->insert_id;
    }else{
        echo '<br>没有新增记录';
    }
}else{
    exit($stmt->errno.":".$stmt->error);
}

运行实例 »

点击 "运行实例" 按钮查看在线实例


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!