php 使用mysqli_insert_id($dbc)一直返回0
if(isset($_POST['submitted'])){$message=$_POST['message'];$send_people=$_POST['send_p...
if(isset($_POST['submitted'])) {
$message = $_POST['message'];
$send_people = $_POST['send_people'];
$user_id = $_SESSION['user_id'];
$q = "insert into send_message(user_id,user_name,message_id,message_content) VALUES ('" . $user_id . "','" . $user_name . "',NULL,'" . $message . "')";
$id = mysqli_insert_id($dbc);
$r = mysqli_query($dbc, $q);
echo "$id";
for ($i = 0; $i < count($send_people); $i++) {
$q1 = "insert into receive_message (message_id ,receive_id,message_status) values('".$id."','".$send_people[$i]."',0)";
$r1 = mysqli_query($dbc, $q1);
printf("%s",mysqli_error($dbc));
}
} 展开
$message = $_POST['message'];
$send_people = $_POST['send_people'];
$user_id = $_SESSION['user_id'];
$q = "insert into send_message(user_id,user_name,message_id,message_content) VALUES ('" . $user_id . "','" . $user_name . "',NULL,'" . $message . "')";
$id = mysqli_insert_id($dbc);
$r = mysqli_query($dbc, $q);
echo "$id";
for ($i = 0; $i < count($send_people); $i++) {
$q1 = "insert into receive_message (message_id ,receive_id,message_status) values('".$id."','".$send_people[$i]."',0)";
$r1 = mysqli_query($dbc, $q1);
printf("%s",mysqli_error($dbc));
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询