Re: odbc_num_rows always returns -1

From: Date: Tue, 20 Nov 2001 13:06:58 +0000
Subject: Re: odbc_num_rows always returns -1
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-75238@lists.php.net to get a copy of this message
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 (#75238) next »