插入数据时MySQL没有出现成功消息。我尝试了if(mysqli_query($ sql))和mysqli_affected_rows($ conn)。这是我的代码
<?php
if(isset($_POST['send']))
{
$name = $_POST['cname'];
$email = $_POST['cemail'];
$mobile = $_POST['cmobile'];
$message = $_POST['cmessage'];
$sent = time();
$conn = mysqli_connect("localhost","root","","charan");
if($conn)
{
$sql = "INSERT INTO requests(cname,cemail,cmobile,cmessage,sent_at) VALUES('$name','$email','$mobile','$message',$sent)";
$msent = mysqli_query($conn,$sql);
if($msent)
{
echo "request is sent";
}
}
}
?>