The code below gives me an error " Can't use function return value". This error is located in the foreach loop.
I know there is a lot of knowledge on this forum. I hope someone can help.
<?php
require("connect.php");
class Book
{
private $book_ID;
private $book_title;
private $book_author;
private $book_category;
public function __constructor($row)
{
$this->book_ID = $row['id'];
$this->book_title = $row['title'];
$this->book_author = $row['author'];
$this->book_category = $row['category'];
}
public function show_book()
{
echo "<strong>" . $this->book_title($row) . "</strong><br />";
}
private function get_category_name($id)
{
$query_category_id = "SELECT name FROM tCategory WHERE ID = '$id'";
$result = mysql_query($query_category_id);
}
} ?>
<h1>Categories</h1>
<?php
//ERROR: Can't use function return value.
foreach ($row as mysql_fetch_array($result, MYSQL_ASSOC)) {
$book = new Book($row);
$book->show_book();
}
?>











