How do I pass date into placeholder for PHP and MS SQL?
The sample code I am using:
$fromDate = '2013-01-01';
$toDate = '2013-02-28';
$empno = 12345;
$sqlStr = "SELECT * FROM histTable WHERE EmpNum = ?
AND toDate >= ? AND fromDate <= ?";
$sqlResult = $this->db->query($sqlStr, $empno, $fromDate, $toDate);
I could not get anything from the database unless I hard code the date values.
Can anyone please help?
Thank you.