我尝试创建一个注册表单,但是有一些我找不到的错误
class.consultas.php
class consultas{
public function nuevousuario($usuario, $pass, $email, $youtubeurl){
$modelo = new conexion();
$conexion = $modelo->get_conexion();
$sql = "insert into fiver_users (user, pass, email, youtubeurl) values (:usuario, :pass, :email, :youtubeurl)";
$statement = $conexion->prepare($sql);
$statement->bindParam(':usuario', $usuario);
$statement->bindParam(':pass', $pass);
$statement->bindParam(':email', $email);
$statement->bindParam(':youtubeurl', $youtubeurl);
if(!statement){ //Line 14 is this
return "Error al crear el registro";
}
else{
$statement->execute();
return "Registro creado correctamente";
}
}
答案 0 :(得分:0)
您在语句变量前面错过了$。
if(!statement){ //Line 14 is this
return "Error al crear el registro";
}
应该是
if(!$statement){ //Line 14 is this
return "Error al crear el registro";
}
有关此问题的详细信息,请查看Why PHP variables start with a $ sign symbol?