RE: Re[2]: [PHP-WIN] Quick One... determining if there are no res ults re turned

From: Date: Tue, 05 Sep 2000 15:28:41 +0000
Subject: RE: Re[2]: [PHP-WIN] Quick One... determining if there are no res ults re turned
Groups: php.windows 
Request: Send a blank email to php-windows+get-2428@lists.php.net to get a copy of this message
Sorry, got lazy... long weekends do that to you I guess! --------------------- John Asendorf - jasendorf@lcounty.com Web Applications Developer http://www.lcounty.com - CHECK OUT THE NEW LOOK! Licking County, Ohio, USA 740-349-3631 > -----Original Message----- > From: Gonzalo Vera [mailto:gvz@eucalipto.net] > Sent: Tuesday, September 05, 2000 11:33 AM > To: Asendorf, John > Cc: php-windows@lists.php.net > Subject: Re[2]: [PHP-WIN] Quick One... determining if there are no > results re turned > > > Check out the manual, it has this comment under the odbc_num_rows > function: > ---------------------- > Note: Using odbc_num_rows() to determine the number of rows available > after a SELECT will return -1 with many drivers. > ---------------------- > At least trying to get num_rows from an Access 95 table, does return > -1. Probably a better way to determine if you do have some result on > your query is something like: > > $r=odbc_fetch_row($sql); > if ($r){ > you have rows, do something > } else { > you don't have rows, do something else > } > > And if you do have rows, you can get them using: > > > while ($r) { > your data_getting routine of choice; > $r=odbc_fetch_rows($sql); // go to the next row > } > > I have found no good way to get the number of rows in an ODBC > connection to Access 95 (and probably any other MS Access), but tou > count the records in the result, which is none too efficient. > > Gonzalo. > > > Hmmmm... I'm using odbc_num_rows (); > > > and I always get -1 > > > any clues? > > > --------------------- > > John Asendorf - jasendorf@lcounty.com > > Web Applications Developer > > http://www.lcounty.com - CHECK OUT THE NEW LOOK! > > Licking County, Ohio, USA > > 740-349-3631 > > > >> -----Original Message----- > >> From: Flint Doungchak [mailto:Flint@netsolutionsllc.com] > >> Sent: Tuesday, September 05, 2000 10:52 AM > >> To: 'Asendorf, John' > >> Cc: php-windows@lists.php.net > >> Subject: RE: [PHP-WIN] Quick One... determining if there are > >> no results > >> re turned > >> > >> > >> Hello, > >> > >> Try using something like: > >> > >> $num = mysql_num_rows($SQL_request); > >> > >> $num will then equal the total number of rows returned. You > >> can then use num > >> in your if then else statements. I hope this is what you wanted. > >> > >> -Flint > >> > >> -----Original Message----- > >> From: Asendorf, John [mailto:JAsendorf@lcounty.com] > >> Sent: Tuesday, September 05, 2000 7:43 AM > >> To: php-windows@lists.php.net > >> Subject: [PHP-WIN] Quick One... determining if there are no results > >> returned > >> > >> > >> Here's a quick one... I wasted all my time finding chop() on > >> my own this > >> morning so someone has to help me find the expression I > need here... > >> > >> I just need to know if the return from an SQL call is empty... > >> > >> e.g. > >> > >> if $SQL_request is empty { > >> do one thing > >> } > >> else { > >> do another thing > >> > >> } > >> > >> Anyone? > >> > >> --------------------- > >> John Asendorf - jasendorf@lcounty.com > >> Web Applications Developer > >> http://www.lcounty.com - CHECK OUT THE NEW LOOK! > >> Licking County, Ohio, USA > >> 740-349-3631 > >> > >> -- > >> PHP Windows Mailing List (http://www.php.net/) > >> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > >> For additional commands, e-mail: php-windows-help@lists.php.net > >> To contact the list administrators, e-mail: > >> php-list-admin@lists.php.net > >> > >> -- > >> PHP Windows Mailing List (http://www.php.net/) > >> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net > >> For additional commands, e-mail: php-windows-help@lists.php.net > >> To contact the list administrators, e-mail: > >> php-list-admin@lists.php.net > >> > >

« previous php.windows (#2428) next »