Link to home
Start Free TrialLog in
Avatar of FrankPorter
FrankPorter

asked on

mysql_fetch_array

Hi,

Please assist how come when I tried to use "mysql_fetch_array($datasetRemark)" the second time nothing came-up, do we need to reset or move to first record?

I'm trying to access the same dataset that had been used earlier.

Thanks.


//this is only for sample...
while ($row = mysql_fetch_array($datasetRemark))
{
if ($row['RemarkID']=="1"){$Counta = $Counta + 1;}
}
echo $Counta;


//2nd time accessing
while ($row = mysql_fetch_array($datasetRemark))
{
if ($row['RemarkID']=="1"){$Countb = $Countb + 1;}
}
echo $Countb;
Avatar of VoteyDisciple
VoteyDisciple

There's no way to do that; once you've fetched a row from the database it's up to you to do whatever you want with it before moving on.

If you're interested in keeping all the rows around, consider something like...

while ($row = mysql_fetch_aray($datasetRemark))
    $rows[] = $row;

(so you'll end up with an array $rows that contains each row).
Avatar of FrankPorter

ASKER

VoteyDisciple,

Thanks very much for the info, would you happen to know how can we use $rows[] in our second condition?
how would the code look like ?

//2nd time accessing
...
...
ASKER CERTIFIED SOLUTION
Avatar of VoteyDisciple
VoteyDisciple

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial