第27行的validate.php中出现一个错误
$connexion->execute(array($_GET["reponse2"]));
我有2页,第一个名为inscription.php,没有错误。 在第二页(validation.php)上,第27行出现一个错误
$connexion->execute(array($_GET["reponse2"]));
Validation.php:
<?php
$bdd = new PDO('mysql:host=localhost;dbname=inscription;charset=utf8', 'root', '');
$reponse = $bdd->query('SELECT * FROM validation');
while($validation = $reponse->fetch()) {
echo 'Pseudo: ';
echo $validation['pseudo'];
echo ' E-mail: ';
echo $validation['email'];
echo '<a href="validation.php?action=accepter&id='.$validation['id'].'">Accepter </a>'; // Il y a une espace pour séparer les liens.
echo '<a href="validation.php?action=refuser&id='.$validation['id'].'">Refuser</a>';
echo '<br/>';
}
if(isset($_GET['action']) AND isset($_GET['id'])) {
$action = $_GET['action'];
if($action == "accepter")
{
$id = $_GET['id'];
$reponse2 = $bdd->prepare("SELECT * FROM validation WHERE id='$id'");
$connexion->execute(array($_GET["reponse2"]));
$pseudo = $connexion['pseudo'];
$passe = $connexion['passe'];
$email = $connexion['email'];
$bdd->query("INSERT INTO connexion VALUES('$id', '$pseudo', '$passe', '$email')");
$bdd->query("DELETE FROM validation WHERE id='$id'");
}
elseif($action == "refuser") {
$id = $_GET['id'];
$bdd->query("DELETE FROM validation WHERE id='$id'");
}
}
?>
错误是:
注意:未定义的变量:第27行的D:\ xampp \ htdocs \ inscription \ validation.php中的连接
致命错误:未捕获错误:在D:\ xampp \ htdocs \ inscription \ validation.php:27中对null调用成员函数execute()堆栈跟踪:#0 {main}抛出在D:\ xampp \ htdocs中\ inscription \ validation.php,第27行