SQL Query正在运行但随机停止

时间:2016-11-23 00:47:24

标签: php mysql

我有一个表单,用户可以将其联系信息(first_name,last_name,电子邮件,电话,网站,评论,托管)提交到数据库。表单工作正常,直到我尝试更改评论'姓名到'说明'在HTML中。现在,当我提交表单时,php回应了响应(因此引导我认为它正确提交),但当我在phpMYAdmin中查看表时,它是空的。

数据库结构是astyle_lefteyebrow>接触

表格结构:

CustomerID (Primary) int(11)             
FirstName   text             
LastName    text             
Email       varchar  (128)           
Phone       varchar  (20)   NULL         
Website     varchar  (500)  NULL         
Description varchar  (2000)          
Hosting     tinyint  (1)

PHP文件:

<?php

$servername = "localhost";
$username = "astyle_quiggly";
$password = "**********";
$dbname = "astyle_lefteyebrow";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

// Check that posts have values
echo $_POST['first_name'];
echo $_POST['last_name'];
echo $_POST['email'];
echo $_POST['phone'];
echo $_POST['website'];
echo $_POST['comment'];
echo $_POST['hosting'];

// prepare and bind
$stmt = $conn->prepare("INSERT INTO Contact (FirstName, LastName, Email, Phone, Website, Description, Hosting) VALUES (?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("ssssssi", $firstname, $lastname, $email, $phone, $website, $description, $hosting);


// set parameters and execute
$firstname = $_POST['first_name'];
$lastname = $_POST['last_name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$website =  $_POST['website'];
$description = $_Post['comment'];
if ($_POST['hosting'] == 'yes') {
$hosting = 1;}
else {
$hosting = 0;
}
$stmt->execute();


$stmt->close();
$conn->close();
?>

我不确定它为什么会起作用然后突然停止,除非它与编码错误有关。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

应该是:

std_logic_vector

而不是:

tmasrc & tdosrc & tm
  

函数不区分大小写,但变量不是。