I try to create a registration form, but there is something wrong that I can not find
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";
}
}
You've missed a $ in front of your statement variable.
if(!statement){ //Line 14 is this
return "Error al crear el registro";
}
Should be
if(!$statement){ //Line 14 is this
return "Error al crear el registro";
}
For more information about this one, check Why PHP variables start with a $ sign symbol?