hi guys I'm trying to retrieve data from mysql server with php, but the variable with YYYY-MM-DD
it not working without date variable it works, anyone know what happened ?
If I try do in MAMP command line work but sending data from url no, please help thanks
pd: sorry for my english and on my local server date value its a date type thanks
http://localhost/arriendo/Hora.php?centroid=111&cancha=1&date=2015-11-22
$cod=$_GET["centroid"];
$cancha=$_GET["cancha"];
$date=$_GET["date"];
$result = mysqli_query($con,"SELECT Hora FROM reserva3 WHERE Cod_centro='$cod'
AND Cancha='$cancha' AND Fecha='$date'");
To see what is wrong with your query try debugging it Here's how I debug query's
echo the query to the screen
$query= "SELECT Hora FROM reserva3 WHERE Cod_centro='$cod' AND Cancha='$cancha' AND Fecha='$date'";
echo $query;
copy the printed query from the screen
execute the query in you db manager (phpmyadmin)
Read the sql error and
change your query accordingly
Assumming you have a timestamp (not only date) I think you can change your query from
SELECT Hora FROM reserva3 WHERE Cod_centro='$cod' AND Cancha='$cancha' AND Fecha='$date'
to
SELECT Hora FROM reserva3 WHERE Cod_centro='$cod' AND date(Cancha)='$cancha' AND Fecha='$date'
If this works it's because of formatting why the first query didn't work. otherwise you have to add your sql error here, so we can fix.