If you read through the dbi docs, you will see that you cannot rely on the rows method 
using SELECT - it should only be trusted for non-select methods.

to quote 'some drivers may return 1- until all rows have been fetched.'

You would do better to do a SELECT COUNT(*).... statement, or fetch all the rows using 
fetchall_arrayref, and evaluate the number of rows in the output.

Jon

-----Original Message-----
From: Jas Grewal [mailto:[EMAIL PROTECTED]]
Sent: 24 May 2002 11:45
To: [EMAIL PROTECTED]
Subject: rows result on a query handle.


Hi All,

I am using DBD::ODBC to connect to a Informix database on a remote
machine, every thing seems to be going fine. Except that when I try
to get the number of rows returned by a query using the syntax bellow
:

if($sth->rows==0){
.... do something
}

The problem is that I know that the row does not exist so I would
expect it to (.. do something), but it dosent. I get a value of '-1'
instaed of '0'. Any ideas why im getting the '-1' value instaed of
'0'???

Reply via email to