I am in PHP 5.6.16 on Windows, and previously was using MySQL for all queries with PDO. The only change I have made here is to use Microsoft SQL Server 2008 instead of MySQL as the DB. As such I have now installed the proper SQLSRV drivers, phpinfo() sees it and is happy, and life has continued on with no database connection errors.
After trying to load some pages with read queries, I saw no data coming through. I have discovered that after my $queryResult = $query->execute();
command, this $queryResult
variable returns FALSE
.
So I went one step higher to find that my actual query in $query
still has my prepared variables and not the bound data. Here is where I bind the variables and execute:
$query->bindParam(':startDate', $startDate);
$query->bindParam(':endDate', $endDate);
$queryResult = $query->execute();
Below is a VarDump of $query
after these:
object(PDOStatement)#16 (1) { ["queryString"]=> string(86) "SELECT * WHERE UNIX_TIMESTAMP(DATE) >= :startDate AND UNIX_TIMESTAMP(DATE) <= :endDate"}
It's my understanding that here, I should see real data, the full query, not the prepared variable. Is there something with MS SQL SRV that I failed to do during setup or initialization? I haven't found any issue similar to this on the web so far.
Thanks.