[unixODBC-support] update: [no] differences between php_odbc_nun_rows and isql command output

Roger Peña Escobio orkcu at yahoo.com
Tue Dec 13 13:01:24 GMT 2005

Hi, I am going to top post my messages because it is
un update .

Now, after looking deeper in the problem, I found that
php odbc module can return the right SQLRowCount
value, but you must get/retrive all the information
from the odbc handle, for example, if you make a
'select' query you must to get all the rows with
odbc_fetch_row() or odbc_result_all() for example like
while (odbc_fetch_row($result)) {};

after that, you can call the function odbc_num_rows()
and get the right number of row retrived, if you do
not run odbc_fetch_row() for all the rows, you will
get -1 always from odbc_num_rows()

there is another problem, that I think is close
relaited with the problem of SQLRowCount, with the php
odbc module you can not do two odbc_exec() in the same
script without free the first result or, and this is
what I fond yesterday and what make me think that this
problem is related with the first one,  run for all
the first result, just like when you want to find the

for me, a complete newbe, this is a problem with the
correct set of the handle, but you might get another
explanation, maybe this is the right aproach and 
right behaivor, I don't know, what do you think?
shoud I report this to freeTDS team or this is a
unixODBC topic ?

PD: appologies for my bad english :-(

--- Roger Peña Escobio <orkcu at yahoo.com> wrote:

> Hi
> please appologies for asking php stuff in this list,
> but I coundn't find any other place where to ask
> about
> odbc specific problems with php
> I am having problems with the odbc_nun_rows() php
> function to get the number of rows I get from a
> query,
> it always return -1 (from the php site it looks that
> it is a very common problem) but when I run the same
> query with isql command I get the right results.....
> my next stept was to find any difference in the way
> each client ask for the num_rows, but both use the
> same SQL function: SQLRowCount() prety much in the
> same way :-(
> I get stuck
> so anybody here know the reason of this behaivor or
> just may help me to continue the research to find
> and
> fix this bug ?
> both clients: php and isql, use the same enviroment:
> unixODBC and freeTDS packages, MSSQL-2k server
> [roger at sauron ~]$ rpm -q unixODBC
> unixODBC-2.2.9-1
> [roger at sauron ~]$ rpm -q freetds
> freetds-0.63-1.2.el4.rf
> [roger at sauron ~]$
> and CentOS-4.2+updates linux distribution
> addicional information: I compiled the most recent
> php4 (4.4.1) with no diffence with the one supply by
> the distribution
> thanks in advance for any tip
> roger
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> http://mail.yahoo.com 
> _______________________________________________
> unixODBC-support mailing list
> unixODBC-support at easysoft.com

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the unixODBC-support mailing list