abaddon5586
-
Posts
7 -
Joined
-
Last visited
Never
Posts posted by abaddon5586
-
-
SQLSTATE: IMSSP code: -28 message: The active result for the query contains no fields.
Looks like it matches
SQLSTATEFor errors that originate from the ODBC driver, the SQLSTATE returned by ODBC. For information about SQLSTATE values for ODBC, see ODBC Error Codes.
For errors that originate from the SQL Server Driver for PHP, a SQLSTATE of IMSSP.
For warnings that originate from the SQL Server Driver for PHP, a SQLSTATE of 01SSP.
from
http://msdn.microsoft.com/en-us/library/cc296200%28SQL.90%29.aspx
but I can't seem to find what the error code -28 means for this driver. (Edit:: other than the brief description of course)
-Ben
-
USE database SELECT TOP 10 field1, field2 FROM table
-Ben
-
Oh, and right before the error in the previous post I run this
if( $result === false ){
echo "Error in statement preparation/execution.\n";
die( print_r( sqlsrv_errors(), true));
}
which makes it through with no error
-
Correct, I connected with php_sqlsrv.dll . I am running into an issue with sqlsrv_fetch though. I'm passing it a valid query in the form of
$result=sqlsrv_query($conn,$query);but am receiving the following error in the code segment
$i=0;while ($i <= $result+1) {
if( sqlsrv_fetch( $result ) === false )
{
echo "Error in retrieving row.\n";
die( print_r( sqlsrv_errors(), true));
}
Connection established. Error in retrieving row. Array ( [0) => Array ( [0) => IMSSP [sqlSTATE) => IMSSP [1) => -28 [code) => -28 [2) => The active result for the query contains no fields. [message) => The active result for the query contains no fields. ) )
Ignore incorrect brackets/parentheses combination. [] was messing up the post so I changed it to [)
But yea, the sqlsrv driver works great so far. A bit of an adjustment since most examples are mssql related.
-
I was able to connect to the DB. Thanks for the info, fun read
For anyone interested, I had to add the extensions to my C:\php\ext directory and the php.ini file, from there just use the new functions as described in
and if you're using mixed authentication here is the format, as this function uses Windows authentication by default.
$connectionInfo = array( "UID"=>"myPassword","PWD"=>"myPassword");$conn = sqlsrv_connect( $serverName, $connectionInfo);
-
I have a new install of PHP with Apache 2.2 on a Windows XP box and am getting the following error when using this line of PHP:
mssql_connect($server,$username,$password) or die ("Could not connect");Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: "servername" in "directory" on line 226.I have the latest version of ntwdblib.dll from http://www.helpspot.com/helpdesk/index.php?pg=kb.page&id=13
The following returns
<?phpif (function_exists('mssql_fetch_row')) {
echo "MSSQL functions are available.<br />\n";
} else {
echo "MSSQL functions are not available.<br />\n";
}
?>
<?php
phpinfo();
?>
MSSQL functions are available.Multiple locations is odd but all relevant files (identical) are in both locations
Configuration File (php.ini) Path C:\WINDOWSLoaded Configuration File C:\php\php.ini
extension_dir C:\php\ext C:\php\ext
Uncommented in php.ini (both C:\Windows and C:\php
extension=php_mssql.dllTested connection using MSSQL Management Studio, login/pwd works.
Have tested this with 2008 SQL Express and 2005 SQL Full, neither works. I do have this install working with MySQL.
Any ideas?
Warning: mssql_connect()
in Microsoft SQL - MSSQL
Posted
You were correct, it was using a return set from "USE database".
Thanks for all the help with this.
-Ben