Hi,
I am building a MySQL query from what a users enters via a form. When I hard code the values in and test it, I get a result. However, when I concatenate the variables into the MySQL statement it doesn't. I am not sure what I'm doing wrong.
Do you have any ideas?
Here's my code:
// Trim the incoming data.
$program = trim($program);
$courseNumber = trim($courseNumber);
$date = trim($date);
// for testing
print("program: " . $program . "<br>");
print("course: " . $courseNumber . "<br>");
print("date: " . $date . "<br>");
//********************************************************************************
// Build sql
$sql = "
SELECT
wCal_test.id,
wCal_test.date,
TIME_FORMAT(wCal_test.startTime, '%l:%i') as startTime,
TIME_FORMAT(wCal_test.endTime, '%l:%i') as endTime,
wCal_test.course,
wCrse_test.courseName
FROM
wCal_test,
wCrse_test
WHERE
wCal_test.course = wCrse_test.course AND
(wCrse_test.program = '" . $program . "' AND
date = '" . $date . "')";
TIA,
ski_woman
:queasy: