Php Query不会插入

时间:2017-07-30 12:59:10

标签: php mysqli

以下代码适用于localhost,但不适用于webhost我也有类似的东西,我改变的唯一的东西是一个工作的表名,但是这个没有工作他们都有相同的表数据和数据类型,它一直说"未插入"这是它失败时所说的部分

<?php
session_start();
include ('mysql_connect.php');

$user = $_SESSION['username'];
$last = mysqli_real_escape_string($con, $_POST['last']);
$first = mysqli_real_escape_string($con, $_POST['first']);
$complaint = $_POST['complaint'];
$address = mysqli_real_escape_string($con, $_POST['address']);
$contact = mysqli_real_escape_string($con, $_POST['contact']);



$sql = "insert into tblComplaint 
(tlLast,tlFirst,tlComplaint,tlAddress,tlContact, tlDate) values ('$last','$first', '$complaint', '$address', '$contact' , 
NOW())";

if (!mysqli_query($con,$sql))
{
 echo 'Not Inserted';
}
else 
{
 echo 'Complaint Successfully Sent';

}


?>

0 个答案:

没有答案