Quantcast
Channel: Microsoft Drivers for PHP for SQL Server forum
Viewing all articles
Browse latest Browse all 163

Result Differ PHP 5.6 SQL Server 2014 and SQLSRV Driver Version 3.2

$
0
0

I've spent days on this with no luck. I've read this article several times through. SQL SRV Driver White Pages. Searching with Google yielded no results that worked. Any Insight would be appreciated. 

My setup, I am running XAMPP with Microsoft's SQLSRV 3.2 driver and  SQL Server 2014 developer edition on a Windows 7 machine.

If I make this query in Microsoft's Management Studio...

USE msdb
SELECT TABLE_NAME, TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE='BASE TABLE'

I get 143 rows returned.

If I make the same query in PHP with this code...

<?php

$newConnectionInfo = array();
$newConnectionInfo['Database'] = "msdb";
$newConnectionInfo['UID'] = "";
$newConnectionInfo['PWD'] = "";
$newConnection = SQLSRV_CONNECT("127.0.0.1", $newConnectionInfo);

if ($newConnection){
	echo "<p>Connection Established.</p>";
	$params = array();
	$tsql = "SELECT TABLE_NAME, TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'";
	$options = array("scrollable" => SQLSRV_CURSOR_KEYSET);
	$getNames = SQLSRV_QUERY($newConnection, $tsql, $params, $options);
	if ($getNames){
		echo "<p>I got something here.</p>";
		var_dump($getNames);
		if (SQLSRV_HAS_ROWS($getNames)){
			$rowCount = SQLSRV_NUM_ROWS($getNames);
			var_dump($rowCount);
			while ($row = SQLSRV_FETCH_ARRAY($getNames, SQLSRV_FETCH_ASSOC)){
				echo "<p>There is more to be had!</p>";
				//var_dump($row);
			}
		}
	} else {
		echo "<p>Falure</p>";
		die (print_r(SQLSRV_ERRORS(), true));
	}

} else {
	echo "<p>Falure</p>";
	die(print_r(SQLSRV_ERRORS(), true));
}

?>

then I only get back 9 rows.

If you see what my mistake is please let me know.



Viewing all articles
Browse latest Browse all 163

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>