Php MYSQL插入:您的SQL语法有错误
当我运行代码时,出现以下错误: 您的SQL语法有错误;请查看与您的MySQL服务器版本相对应的手册,以了解第1行中靠近“”、“”、“”、“”、“”、“”)的正确语法 这是我的代码:Php MYSQL插入:您的SQL语法有错误,php,mysql,insert-into,Php,Mysql,Insert Into,当我运行代码时,出现以下错误: 您的SQL语法有错误;请查看与您的MySQL服务器版本相对应的手册,以了解第1行中靠近“”、“”、“”、“”、“”、“”)的正确语法 这是我的代码: <?php require('connect.php'); $username=mysql_real_escape_string($_POST['Username']); $password=mysql_real_escape_string($_POST['Password']); $nome=mysql_r
<?php
require('connect.php');
$username=mysql_real_escape_string($_POST['Username']);
$password=mysql_real_escape_string($_POST['Password']);
$nome=mysql_real_escape_string($_POST['Nome']);
$cognome=mysql_real_escape_string($_POST['Cognome']);
$email=mysql_real_escape_string($_POST['Email']);
$città=mysql_real_escape_string($_POST['Città']);
$via=mysql_real_escape_string($_POST['Via']);
$civico=mysql_real_escape_string($_POST['Civico']);
$cap=mysql_real_escape_string($_POST['CAP']);
$cf=mysql_real_escape_string($_POST['CF']);
$telefono=mysql_real_escape_string($_POST['Telefono']);
$numeroCarta=mysql_real_escape_string($_POST['NumeroCarta']);
$scadenza=mysql_real_escape_string($_POST['Scadenza']);
$cvv=mysql_real_escape_string($_POST['CVV']);
$tipoCarta=mysql_real_escape_string($_POST['TipoCarta']);
if(isset($_POST['submit'])){
$flag = 0;
$query =mysql_query("SELECT * FROM cliente WHERE username = '".$username."'");
if (mysql_num_rows($query) > 0) {
if($username){
echo '<b>Username già in uso.</b><br/>';
echo "Torna alla <b><a href='http://127.0.0.1//supermercato/inserimentoDati.php'>registrazione</a></b>.";
$flag =1 ;
}
}
if ($flag == 0) {
$query="INSERT INTO cliente(Email,Città,Via,CAP,Civico,CF,Telefono,Nome,Cognome,Password,Username,Numerocarta,Scadenza,CVV,TipoCarta) VALUES('$email','$città','$via','$cap','$civico','$cf','$telefono','$nome','$cognome,'$password','$username','$numeroCarta','$scadenza','$cvv','$tipoCarta');";
$result=mysql_query($query);
echo mysql_error();
if($result){
echo "<b>Dati inseriti correttamente!</b>";
echo "Vai al <b><a href='http://127.0.0.1//supermercato/login.php'>LOGIN</a></b>.";
} else {
echo "<b>Non è stato inserito nessun dato.</b><br/>";
echo "Torna alla <b><a href='http://127.0.0.1//supermercato/inserimentoDati.php'>registrazione</a></b>.";
}
}
}
mysql_close();
?>
您在当前拥有的cognome
之后缺少一个
'$nome','$cognome,'$password',
应该有
'$nome','$cognome','$password',
在您当前拥有的cognome
之后缺少一个'
'$nome','$cognome,'$password',
应该有
'$nome','$cognome','$password',
在您当前拥有的cognome
之后缺少一个'
'$nome','$cognome,'$password',
应该有
'$nome','$cognome','$password',
在您当前拥有的cognome
之后缺少一个'
'$nome','$cognome,'$password',
应该有
'$nome','$cognome','$password',
在插入之前,您是否尝试回显您的查询?听起来你需要摆脱你的束缚。此外,您应该开始研究MySQL的替代方案,因为它已经贬值。尝试打印\r($\u POST)
并将结果粘贴到此处,看起来有些字段是空的。回显查询并运行,查看是否存在所有参数值。在phpmyadmincognome中运行它缺少一个倒引号您缺少一个引号'$cognome,
请在插入到客户机中的中更改为'$cognome'
。
插入之前是否尝试回显您的查询?听起来你需要摆脱你的束缚。此外,您应该开始研究MySQL的替代方案,因为它已经贬值。尝试打印\r($\u POST)
并将结果粘贴到此处,看起来有些字段是空的。回显查询并运行,查看是否存在所有参数值。在phpmyadmincognome中运行它缺少一个倒引号您缺少一个引号'$cognome,
请在插入到客户机中的中更改为'$cognome'
。
插入之前是否尝试回显您的查询?听起来你需要摆脱你的束缚。此外,您应该开始研究MySQL的替代方案,因为它已经贬值。尝试打印\r($\u POST)
并将结果粘贴到此处,看起来有些字段是空的。回显查询并运行,查看是否存在所有参数值。在phpmyadmincognome中运行它缺少一个倒引号您缺少一个引号'$cognome,
请在插入到客户机中的中更改为'$cognome'
。
插入之前是否尝试回显您的查询?听起来你需要摆脱你的束缚。此外,您应该开始研究MySQL的替代方案,因为它已经贬值。尝试打印\r($\u POST)
并将结果粘贴到此处,看起来有些字段是空的。回显查询并运行,查看是否存在所有参数值。在phpmyadmincognome中运行它缺少一个倒引号您缺少一个引号'$cognome,
在您的插入到客户中…
中更改为'$cognome'
,谢谢您的快速回复,先生。这就是问题所在!谢谢您的快速回复,先生。这就是问题所在!谢谢您的快速回复,先生。这就是问题所在!谢谢您的快速回复,先生。这就是问题所在!