<?= MySQLi("localhost","root","12345678","heiheihei" = "select * from student" = ->query(( = -> (?>
最后的返回值是一个集对象,为了方便清晰的看到结果 我们用到了fetch_all(),fetch_row(); fetch_object();
//造连接对象$db = new MySQLi("localhost","root","12345678","heiheihei");//准备SQL语句$sql = "insert into cou values('3-111','嘿嘿','803')"; //执行SQL语句$r = $db ->query($sql);if($r)//如果$r是ture{ echo "执行成功"; }else { echo "执行失败"; }
<?php//造连接对象$db = new MySQLi("localhost","root","12345678","heiheihei");//准备SQL语句$sql = "update cou set cname='哈哈' where tno='803'"; //执行SQL语句$r = $db ->query($sql);if($r) { echo "执行成功"; }else { echo "执行失败"; }?>
<?php//造连接对象$db = new MySQLi("localhost","root","12345678","heiheihei");//准备SQL语句$sql = "delete from cou where tno='803'"; //执行SQL语句$r = $db ->query($sql);if($r) { echo "执行成功"; }else { echo "执行失败"; }?>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。