<?php
servername="localhost";
username="root";
password="";
$my_DB="demo";
//创建连接
$mysqli=new mysqli($servername,$username,password,$my_DB);
//判断连接是否成功;
if($mysqli->connect_error){
die("连接数据库失败!"。$mysqli->connect_error());
}
//预处理及邦定
$sql=$mysqli->prepare("INSER INTO student( id,stuname,stuAge,tel)values(?,?,?,?)");
$sql=bind_param("isii",$id,$stuname,$stuAge,$tel);
//设置参数并执行
$id=1008;
$stuname="zhangshan";
$stuAge=20;
$tel=18888888888;
$sql->execute();
$id=1006;
$stuname="xiaohongmao";
$stuAge=20;
$tel=16666666666;
$sql->execute();
?>