I am trying my hand at using the joomla way of accessing my database records but not having much luck.
I have a "while" loop that I need to execute to display each of my records from the database.
Can someone please help me with the correct code to achieve this.
This is what I have tried without success.
I did try the "while" loop but commented it out and tried the "foreach"...but it's no good either.
Code: Select all
$db->setQuery($query);
$row = $db->loadAssoc();
//while($row = mysqli_fetch_array($row)) {
foreach($query->result() AS $row) {
echo "Record".$row['id'];
echo "Name".$row['name'];
}
This is the error I am getting: " Call to a member function result() on string "