Sorry to say that didn't work. I was able to pass the resultset out of the method to the page, but it still just looped forever writing the first record.
However, after searching around and observing several DB classes other people had written, I didn't see anyone actually passing the resultset, but rather loading that resultset into an array, and passing the array.
I did that, and it works like a charm. Observe:
function result_to_array($sql) {
if ($result = $this->query($sql)) {
$res_array = array();
for ($count=0; $rst = $result->fetch(); $count++) {
$res_array[$count] = $rst;
}
return $res_array;
} else {
return FALSE;
}
}
That was the function placed in the MySQL class (a.k.a. $db). Here is how I use it in my other method:
function viewPermissions() {
$sql = "SELECT * FROM " . PERM_TABLE;
return $this->db->result_to_array($sql);
}
Then, when I call it on a page, I just do something like this:
foreach ($userAdmin->viewPermissions() as $rstPermissions) {
//do something with the data
echo $rstPermissions[PERM_ID]."<br>";
echo $rstPermissions[PERM_NAME]."<br>";
}
Anyway, it is working great like that so I am happy. I just wanted to make sure I gave the feedback, in appreciation for the effort to help.
cheers,
Clay