| 代码如下 | 复制代码 |
$servername="localhost"; $username="root"; $password="admin"; //$dbname为我的test数据库 $dbname="test"; try{ $conn=newPDO("mysql:host=$servername;dbname=$dbname",$username,$password); //设置pdo错误异常处理 $conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); //预处理SQL并绑定参数 $stmt=$conn->prepare("INSERT INTO user(user_first,user_last,age)VALUES(:user_first,:user_last,:age)"); $stmt->bindParam(":user_first",$user_first); $stmt->bindParam(":user_last",$user_last); $stmt->bindParam(":age",$age); //要执行的插入记录 $user_first="xiao"; $user_last="liang"; $age=15; $stmt->execute(); //要执行的插入记录 $user_first="xiao"; $user_last="cheng"; $age=23; $stmt->execute(); echo"News record created successfully!"; }catch(PDOException$e){ echo"Error:".$e->getMessage(); } $conn=null; | |
韩剧再婚皇后阿里云盘全集高清1080P资源链接-韩剧再婚皇后免费阿里云盘资源下载4K高清无删减版链接
poipiku网站如何打开-poipiku官网网页版访问入口
明日方舟:终末地-云游戏畅玩入口-明日方舟:终末地-网页版在线直连地址
poki在线小游戏网页版-poki免费游戏大全入口
poki游戏入口-点开即玩-poki游戏-在线免费畅玩
原神akt大佬资源viciNeko入口链接-原神akt大佬资源网页vicineko入口链接分享