I tried asking this before but didnt really get an answer so Ill try to rephrse it. I cant figure out how to pass the results of a multi line query to another function or page, especially using PDO. Would I execute the loop in the original function?
public function viewGallery(){
$pQuery = 'SELECT * FROM profiles WHERE userId = ?';
$viewGallery = $this-> _db ->prepare($pQuery);
$viewGallery ->bindParam(1, $id);
$viewGallery ->execute();
while ($get_row = $viewGallery ->fetch()){
$id = $get_row['id'];
}
}
then another page that accesses this:
//echo the results of viewGallery();
You need to return the results you want from viewGallery() then echo them on the other page.
You could return an array of results (ids by the looks of it) and then whiz through them with a while loop on your other page to display them
Then on the other page just loop through and echo each result