<?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