php5.4以上 mysqli 实例操作mysql 增,删,改,查

 1 php
 2 //php5.4以上 mysqli 实例操作mysql
 3 header("Content-type:text/html;charset=utf8");
 4 $conn = new mysqli('localhost', 'root', 'root');
 5 mysqli_select_db($conn, 'cc');
 6 $conn->query('set names utf8');
 7 $sql_search = "select * from bb where id=9";
 8 /*$sql_add = "insert into bb(name) values ('小明')";
 9 $sql_update = "update bb set name = '小h' where id=9";
10 $sql_del = "delete from bb  where id=9";*/
11 $result = $conn->query($sql_search);
12 while ($row = $result->fetch_array()) {
13     echo $row['name'] . '
'; 14 } 15 $conn->close();

 

转载于:https://www.cnblogs.com/handle/p/9232374.html

你可能感兴趣的:(php5.4以上 mysqli 实例操作mysql 增,删,改,查)