Page 1 of 1

Recordset

Posted: Mon Feb 16, 2009 2:07 am
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.

Re: Recordset

Posted: Mon Feb 16, 2009 2:28 am
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.

Re: Recordset

Posted: Mon Feb 16, 2009 2:40 am
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.