I am a total beginner when it comes to PHP and SQL so please forgive me. Trying to figure out why my SQL statement will not work when passing it a variable for tblEmployees.Workgroup. It works perfectly fine when I put "CS Lead" vs the variable. Please let me know if I need to include any other information. Thanks!
<?php
include 'header.php'; //Include header
include 'sidebar.php'; //Include sidebar
$workgroup = 'CS Lead';
$stmt = $db->query("SELECT
tblSchedule.CurrentSchedule,
tblSchedule.Login,
tblSchedule.StartTime,
tblSchedule.EndTime,
tblSchedule.Sunday,
tblSchedule.Monday,
tblSchedule.Tuesday,
tblSchedule.Wednesday,
tblSchedule.Thursday,
tblSchedule.Friday,
tblSchedule.Saturday,
tblSchedule.Lunch_Start,
tblSchedule.Lunch_End,
tblSchedule.Brk1_Start,
tblSchedule.Brk1_End,
tblSchedule.Brk2_Start,
tblSchedule.Brk2_End,
tblSchedule.Brk3_Start,
tblSchedule.Brk3_End,
tblSchedule.Lunch2_Start,
tblSchedule.Lunch2_End,
tblSchedule.TM_Day,
tblSchedule.TM_Start,
tblSchedule.TM_End,
tblEmployees.Workgroup
FROM tblSchedule
LEFT JOIN tblEmployees
ON tblSchedule.Login=tblEmployees.Login
WHERE CurrentSchedule='Y' AND tblEmployees.Workgroup = ' . $workgroup . '
LIMIT 100");
$stmt -> execute();
?>