I am trying to get this statement to work but Im guessing there must be an error in it because it does not produce any results or errors at all. Can someone with more experience and fresh eyes look it over to see if I have something wrong. Code is below:
$conn = new PDO('mysql:host=localhost;dbname=timecard', 'username', 'password');
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare('UPDATE `timeRecords` SET `jobDescription`= :jobDescription, `equipType`= :equipType, `unitNumber`= :unitNumber, `unitHours`= :unitHours)
WHERE `employeeID`= :employeeID AND `date`= :dateToday');
$stmt->execute(array(':employeeID' => $_SESSION['employeeID'], ':dateToday' => $dateToday, ':jobDescription' => $jobDescription,
':equipType' => $equipType, ':unitNumber' => $unitNumber, ':unitHours' => $unitHours));
Error found in the original code I left a
)beforeWHEREit was found thanks to the suggestion to use thetry/catch blockupdated and working code below: