我遇到了向mysql服务器插入详细信息的问题。 这是代码(一个简单的代码):
<?php
//Input posted data.
$Fname = $_POST["Fname"];
$Lname = $_POST["Lname"];
$Date = $_POST["Date"];
$Mail = $_POST["Mail"];
$Pass = $_POST["Pass"];
// Create connection
$conn = mysqli_connect('localhost','root',"");
//Check if the connection was opened, if not prompt the error to the page.
if ($conn)
{
die('Could not connect: ' . mysql_error());
}
//Select the data base.
mysqli_select_db("club",$conn);
//Set the character set to utf-8 to allow hebrew.
mysqli_query("SET NAMES 'utf8'");
//SQL query - user Details
$sql = "INSERT INTO 'customers' (Fname, Lname, Mail, Date, Pass)
VALUES('$Fname','$Lname','$Mail','$Date','$Pass');
//Run SQL query
$results = mysqli_query($query) or die (mysql_error());
//Close the SQL connection.
mysqli_close($conn);
?>
我收到了这个错误:
解析错误:语法错误,第36行的C:\ xampp \ htdocs \ Contact.php中的文件意外结束&lt; ---最后一行
真的可以使用你的帮助。
提前谢谢, 杰森。答案 0 :(得分:2)
$结果= mysqli_query($ SQL);
你给了$ query而不是$ sql