
Error con declaración de variables PHP
Publicado por Alejandro (2 intervenciones) el 16/11/2017 23:43:22
Que tal, cuando pongo la dirección localhost/Cita.php en mi navegador para checar si hay algún error en mi sintaxis me aparece lo siguiente:
Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs\Cita.php on line 10
Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs\Cita.php on line 11
Este es mi código:
Warning: mysqli_stmt_bind_param() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs\Cita.php on line 10
Warning: mysqli_stmt_execute() expects parameter 1 to be mysqli_stmt, boolean given in C:\xampp\htdocs\Cita.php on line 11
Este es mi código:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
$con = mysqli_connect("localhost", "root", "", "usuarios");
$estudio = $_POST["estudio"];
$fecha = $_POST["fecha"];
$room = $_POST["room"];
$name = $_POST["name"];
$hora = $_POST["hora"];
$statement = mysqli_prepare($con, "INSERT INTO estudios (estudio,fecha,room,name,hora) VALUES (?, ?, ?, ?, ?)");
mysqli_stmt_bind_param($statement, "ssssi", $estudio, $fecha, $room, $name, $hora);
mysqli_stmt_execute($statement);
$response = array();
$response["success"] = true;
echo json_encode($response);
?>
Valora esta pregunta


0