0
我得到這個錯誤, PDOStatement :: execute():SQLSTATE [HY093]:無效的參數編號:綁定變量的數量與/ storage/h14/202/1552202/public_html中的標記數量不匹配/第38行的signup.php。 這是怎麼回事?我看不到它。Mysql錯誤093
<?php
if (isset($_POST['signup'])){
$username = $_POST['Username'];
$password = $_POST['Password'];
try {
$db = new PDO('mysql:host=localhost;dbname=Accounts', 'id1552202_thecouch', 'Fargo123');
$query = $db->prepare(" INSERT INTO Accounts(Usernames, Passwords) VALUES (:username ,". sha1(":password") .")");
$query->bindParam("username", $username);
$query->bindParam("password", $password);
if($query->execute()){
echo "<center>Account made</center>";
} else {
echo "Error";
}
} catch(PDOException $e){
die("Error!: " . $e->getMessage());
}
}
?>
SHA1不安全 –
SQL文本中不包含':password'佔位符。回聲SQL文本,你會看到發生了什麼......'sha1'函數調用正在使用字符串參數..並且函數的返回值正被包含在SQL文本中。 https://ericlippert.com/2014/03/05/how-to-debug-small-programs/ – spencer7593