I am using fullcalendar, I have a checkbox on the home page which decides which events are shown.
One of the options are all of the events, and the other option are specifically tailored events.
$alterAMPM = $_POST['alterAMPM'];
$AMPM = $_POST['ampm'];
$alterDate = $_POST['alterDate'];
$date = $_POST['date'];
$dateTime = $_POST['datetime'];
$alterDoctor = $_POST['alterDoctor'];
$doctor = $_POST['doctor'];
$json = array();
// Query that retrieves events
$buildQuery = "SELECT * FROM DoctorAvailability WHERE backgroundColor = 'green'";
if ($alterAMPM = 'No'){
if ($AMPM = 'A'){
$buildQuery .= " AND start < $date";
}else if($AMPM = 'P'){
$buildQuery .= " AND start > $date";
}
}
if ($alterDate = 'No'){
$buildQuery .= " AND start >= $date AND start < DATE_ADD($date, INTERVAL 1 DAY)";
}
if ($alterDoctor = 'No'){
$buildQuery .= " AND title = $doctor";
}
I am building the query depending on data brought back.
The correct string is passed HTML side.
http://localhost:8080/php/getrecommendedappoint.php?alterAMPM=Yes&m=A&alterDate=No&date=2015-12-04&datetime=2015-12-04%2012:00:00&alterDoctor=Yes&doctor=Curly&start=2015-12-07&end=2015-12-14&_=1449492506627
but when printing out the string sent the following is shown.
SELECT * FROM DoctorAvailability WHERE backgroundColor = 'green' AND start < AND start >= AND start < DATE_ADD(, INTERVAL 1 DAY) AND title =
For some reason the values aren't being added in..
I have tried by using " + valuetoadd + " as well.
Within other queries the way I have used has worked fine.
@Saty answered this question correctly. I needed to replace POST with GET. I don't believe this is a duplicate.