Re: trouble with odbc

From: Date: Thu, 01 Feb 2001 19:02:48 +0000
Subject: Re: trouble with odbc
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-37683@lists.php.net to get a copy of this message
hi michael, if you read the PHP manual, i think it says something like "odbc_num_rows" might or might not return the correct number of rows after a "SELECT" statement. in the case of easysoft odbc driver (which is what we're using as well), odbc_num_rows always returns -1 on a SELECT statement (it does return the correct number of rows on INSERT/UPDATE/DELETE). hope this helps. :) btw, a quick question. have you been able to get the easysoft odbc driver to return a more informative error message when a SQL query fails? (usually it just says "statement could not be prepared", it would be far more useful if it actually returns the same error message that MSSQL 7's query analyzer returns) remco chang www.bountyquest.com ----- Original Message ----- From: "Michael Geier" <mgeier@cdmsports.com> To: "PHP Mailing List" <php-general@lists.php.net> Sent: Thursday, February 01, 2001 12:44 PM Subject: [PHP] trouble with odbc > I am running php4.04pl1 on RedHat6.2 with --esoob (EasySoft) connecting to > MSSQL 7.0 on WinNT 4. > The connection to this db works from another program on same machine. > > <? > $connection = odbc_connect("dsn","user","password") or die > ('could not > connect to db'); > $query = "SELECT * FROM customer WHERE email LIKE 'user@%'"; > $result = odbc_exec($connection,$query) or die('could not execute query'); > $count = odbc_num_rows($result); > echo $count; > ?> > > $count is returning -1. > > When running SQL Server Enterprise Mgr. on NT box, this query reurns 3 dummy > records. Does anyone see the error? All help appreciated. > > Michael Geier > CDMSports Systems Administration > EMail: mgeier@cdmsports.com > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#37683) next »