php使用mysqli连接数据库
时间:2021-07-01 10:21:17
帮助过:39人阅读
= mysqli_connect(
‘localhost‘,
‘root‘,
‘‘,
‘addressBook‘) or die(
‘Connect error!‘);
$sql =
"insert into ".
$this->tb_group.
" value(‘‘, ‘$name‘, ‘$pwd‘, ‘$numIdList‘)";
$result =
$conn->query(
$sql); //添加成功result的值为boolean值
true
//
$result = mysqli_query(
$conn,
$sql);
if (
$result) {
$lastid = mysqli_insert_id(
$conn); //刚刚插入数据库的记录id
echo "<BR>新建通讯录成功!";
}
else{
echo "<BR>新建通讯录失败!";
}
php使用mysqli连接数据库
标签:php mysqli 刚刚插入的id