Reputation: 22040
I am doing a simple select from a mssql db.
$sql = "select * from dbo.table where [xxx] ='".$_POST['xx']."' AND [yyy]='".$_POST['yy']."'";
$StmtUser = sqlsrv_query( $conn, $sql );
And when I am echo-ing it does not print result
echo $StmtUser['xxx'];
$serverName = "usr\SQLEXPRESS";
$connectionInfo = array( "Database"=>"dbname", "UID"=>"x12", "PWD"=>"123");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
How do I get to print echo $StmtUser['xxx'];
Upvotes: 0
Views: 37
Reputation: 16101
sqlsrv_query()
returns a statement resource so you need to use sqlsrv_fetch_array()
before you can access any values.
...
$ResultUser = sqlsrv_fetch_array($StmtUser);
echo $ResultUser['xxx'];
Upvotes: 2