<?php
$fname= $_REQUEST['firstname'];
$lname= $_REQUEST['lastname'];
$email= $_REQUEST['email'];
$pass = $_REQUEST['password'];
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn)
{
die('Could not connect ');
}
$ins1 = "INSERT into signup values('$fname' , '$lname', '$email','$pass')";
$select = mysql_select_db('ait', $conn);
if(! $select)
{
die("<h2> incorrect input <h2>".mysql_error());
header('location:index.php');
}
$in1 = mysql_query($ins1);
if (!$in1)
{
die("<h2> incorrect input <h2>".mysql_error());
header('location:signed.php');
}
mysql_close($conn);
header('location:signed.php');
exit;
?>
我正在注册表单并将其添加到数据库中但我得到此错误“错误的输入列计数不匹配值计数在第1行“。我没有从这个代码插入id,因为它是自动增量。不正确的输入列计数与第1行的值计数不匹配
显示'注册表'结构。 –
尝试在查询中明确指定列名称。 'INSERT INTO table(column1,column2)VALUES(value1,value2)'此外,请注意,您的代码* *开放** * SQL注入**。您将用户输入视为代码并执行用户向您发送的任何内容。 – David
我是PHP新手,仍在学习。所以我需要了解更多关于SQL注入的知识。 – AshirogiMuto