[PHP] trouble with odbc

2001-02-01 Thread Michael Geier

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: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] trouble with odbc

2001-02-01 Thread Remco Chang

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" [EMAIL PROTECTED]
To: "PHP Mailing List" [EMAIL PROTECTED]
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: [EMAIL PROTECTED]


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]