1、连接(mysqli方式)
$con = new mysqli("localhost", "username", "password", "databasename");
2、查询
$con->query('set names utf8;');
$sql = "SELECT * FROM tablename";
$result = $con->query($sql);
$data=array();
while ($tmp=mysqli_fetch_assoc($result)) {
$data[]=$tmp;
}
var_dump($data);
3、插入
$con->query('set names utf8;');
$sql="INSERT INTO tablename (name,telphone) VALUES ('name','telphone')";
if($result = $con->query($sql)){
echo "成功";
}else{
echo "失败";
}