mysql - Use a PHP Variable on SELECT DateTime Between -
public function storereserva2($fechaini) { $stmt1 = $this->conn->prepare("select count (*) reserva ? between fechaini , fechafin"); $stmt1->bind_param("s", $fechaini); $result1 = $stmt1->execute(); $stmt1->close(); echo $result1; print $result1; if ($result1 === null) { $uuid = uniqid('', true); $stmt = $this->conn->prepare("insert reserva(unique_id, fechaini, fechafin) values(?, ? , ? + interval 2 hour)"); $stmt->bind_param("sss", $uuid, $fechaini, $fechaini); $result = $stmt->execute(); $stmt->close(); // revisa si se hizo la reserva con su id unica if ($result) { $stmt = $this->conn->prepare("select * reserva unique_id = ?"); $stmt->bind_param("s", $uuid); $stmt->execute(); $reserva = $stmt->get_result()->fetch_assoc(); $stmt->close(); return $reserva; } } else { $reserva = $result1; return $reserva; } }
it return me
fatal error: call member function bind_param()
please want compare $fechaini
variable if between fechaini
, fechafin
rows in table reserva
.
Comments
Post a Comment