이 내 코드입니다 :SQLSTATE [HY093]
이if (!isset($_POST['cellulare'])) $cell = "-"; else $cell = $_POST['cellulare'];
if (!isset($_POST['ufficio'])) $uff = "-"; else $uff = $_POST['ufficio'];
if (!isset($_POST['email'])) $email = "-"; else $email= $_POST['email'];
$sqlup = "UPDATE rubrica SET nome = :nm,
cognome = :cgm,
mail = :email,
cellulare = :cell,
ufficio = :office,
WHERE id=".$_GET['mod'];
$stmt = $pdo->prepare($sqlup);
$stmt->bindParam(':nm', $_POST['nome'], PDO::PARAM_STR);
$stmt->bindParam(':cgm', $_POST['cognome'], PDO::PARAM_STR);
$stmt->bindParam(':email ', $email, PDO::PARAM_STR);
$stmt->bindParam(':cell', $cell, PDO::PARAM_STR);
$stmt->bindParam(':office', $uff, PDO::PARAM_STR);
$stmt->execute();
분명히 오류가없는,하지만 난이 얻을 :
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: parameter was not defined'
'$ _GET [ 'mod']'은 (는) 비어 있지 않으며 정수를 포함합니까? – Legionar
왜'$ _GET [ 'mod']'를 바인딩하지 않습니까? 'email' 바인딩은 이름에 여분의 공백이 있습니다. – chris85
왜 당신은 또한'id = "를 매개 변수화하고 바인딩하지 않습니까? $ _ GET [ 'mod']'당신의 스크립트는 [SQL Injection Attack]의 위험이 있습니다. (http://stackoverflow.com/questions/60174/how-can -i-prevent-sql-injection-in-php) [Little Bobby Tables] (http://bobby-tables.com/)에 무슨 일이 있었는지 살펴보기 [입력을 탈출하고 있다면, 안전하지 않은 !] (http://stackoverflow.com/questions/5741187/sql-injection-that-gets-around-mysql-real-escape-string) [준비된 매개 변수가있는 문] (http://php.net/manual /en/mysqli.quickstart.prepared-statements.php) – RiggsFolly