Re: odbc_num_rows always returns -1

From: Date: Tue, 20 Nov 2001 13:08:59 +0000
Subject: Re: odbc_num_rows always returns -1
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-75239@lists.php.net to get a copy of this message
Also (I forgot to tell you) you can use that -1 number. The fact that it is -1 tells you you have records that have been retrieved. Otherwise it will return 0. Cheers, Joe :) "Joe Van Meer" <joe@coastaldestination.com> wrote in message news:20011120130527.79829.qmail@pb1.pair.com... > Hi Peter, from what I hear (and what I've read) with sqlServer you'll always > get a result of -1 for num_rows. To get an accurate count you'll have to use > the count() on the db in a select query. That's one workaround, no doubt > there are others. > > SELECT COUNT(my_id) FROM TABLE ... > > Cheers Joe :) > > > "Peter Lavender" <plaven@bigpond.net.au> wrote in message > news:017301c171b9$dab26f60$090ba8c0@winnie... > > Hi Everyone, > > > > As the subject says. > > > > I'm using 4.0.6 on IIS/win2k to a MSSQL 2000 database. > > > > I wish to check if a query returns any values, so the code I have is > nothing > > more than: > > > > $numRows = odbc_num_rows($result); > > print ("$numRows<br>"); > > if ($numRows <= 0) { > > > > print("Nothing to show"); > > > > } > > > > Have I missed something.. with the result always being -1, it causes me > some > > problems.. :) > > > > Thanks > > > > Pete > > > >

« previous php.general (#75239) next »