I am using PDO to get data from MSSQL but I cant seem to get any results when I select it from a view.
This is what I got.
My view is called cdr_view
. The view definitely has data if I run the same SQL
And a table is called cdr
.
<?php
$conn = new \PDO("dblib:host=host;dbname=XC5_XS","someuser","somepass");
$stmt = $conn->prepare("select * from cdr_view;"); //0 results
//$stmt = $conn->prepare("select * from cdr;"); //get heaps of results.
$stmt->execute();
while ($row = $stmt->fetch()) {
print_r($row);
}
Do i need to use view.cdr_view
or somehow let the database know that it is a view I want and not a table?