Assume I\'m in need to loop twice with the result I got form PDO prepared statement.
First loop works fine, the next one does not work
The value of var_d
Your are fecth a row time by time if you need two iteration you should perform a copy eg storing rows
while ($row = $q->fetch(PDO::FETCH_ASSOC)){
echo "
" . $row['user_id'] . "--". $row['fname']. "";
$my_rows[] = $row;
}
// second loop this loop will NOT echo any thing ?!
foreach($my_rows as $key=>$value){
echo "
" . $value['user_id'] . "--". $value['fname']. "";
}