So we have Sharepoint and I am trying to extract certain information from the sharepoint SQL and code a page to output that data.
This is what i have:
<?php
$serverName = "127.0.0.1";
$connectionInfo = array("Database"=>"SharedServices_DB");
$conn = sqlsrv_connect($serverName, $connectionInfo);
var_dump($conn);
echo("<br />");
$sql = "SELECT TOP 100
Name = upf.PreferredName,
Email = upf.Email,
Modified = upf.LastUserUpdate,
Property = pl.PropertyName,
Value = upv.PropertyVal
FROM
dbo.UserProfile_Full upf,
dbo.UserProfileValue upv,
dbo.PropertyList pl
WHERE
upv.RecordID = upf.RecordID
AND pl.PropertyID = upv.PropertyID
ORDER BY Name ASC";
$stmt = sqlsrv_query($conn, $sql);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
var_dump($stmt);
echo("<br />");
$row_count = sqlsrv_num_rows( $stmt );
var_dump($row_count);
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
var_dump($row);
//$second = $row['Department'];
//if($first != $second){
//if($row['Name'] != NULL || $row['Email'] != NULL){
echo('<div id="department">'.$row['Name'].'</div><hr />');
//$first = $row['Department'];
//}
}
sqlsrv_free_stmt( $stmt);
?>
I know for sure the $sql works I manually did the query on the sql server and it output all the data i needed.
But on the PHP site it is coming up blank not outputting anything.
Here are the results of the var_dump