I am currently in the process of learning PDO. I am trying to have multiply while statements, using the same variable. Now, when I used normal MySQL, I just used the mysql_data_seek();
function, in order to do this.
I have this code:
$r = $dbh->prepare("SELECT * FROM memberships ORDER by sort DESC");
$r->bindParam(':id', $userdata['membership']);
$r->execute();
<?php while($upgData = $r->fetch(PDO::FETCH_ASSOC)): ?>
echo $upgData['id'];
<?php ?>
Then further down the code, I want to use it again:
<?php while($upgData = $r->fetch(PDO::FETCH_ASSOC)): ?>
echo $upgData['name'];
<?php ?>
Although, the second time, nothing gets printed out. Why is that?