Recordset

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dheeraj
Forum Commoner
Posts: 40
Joined: Fri Feb 06, 2009 11:54 am

Recordset

Post by dheeraj »

hello guys, i have a confusion that, can we use a recordset more than one time or not???

suppose i have following recordset..

Code: Select all

 
<?php
mysql_select_db($database_login, $login);
$query_Recordset1 = "SELECT * FROM promotion";
$Recordset1 = mysql_query($query_Recordset1, $login) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
 
Now suppose i have fetch it as follows...

Code: Select all

 
<?php do
{
...............
...............
...............
}while($row_Recordset1 = mysql_fetch_assoc($Reordset1));
?>
 
now i want to know tht, can i again use it as above......

thanks Dheeraj.
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: Recordset

Post by susrisha »

best way to know is TRY...

I have tried it earlier in my scripts but with no luck. Once i put a mysql_num_rows on a result and then try to print some of its results.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Recordset

Post by requinix »

If you need it twice then collect whatever you need the first time around and use THAT instead.

But yes, it is possible to reuse a resultset.
Post Reply