vee w Fri Jan 18 03:01:16 -0500 2013

Subject: i want example "JOIN" please.

these are my tables
categories
id|category_name|category_order

books
id|category_id|book_name

this is my Book model
models/Book.php
class Book extends ActiveRecord\Model {
static $table_name = 'pre_books';
function list_books( $data = array() ) {
$join = 'LEFT JOIN '.TBPREFIX.'categories ON ('.TBPREFIX.'categories.id = '.TBPREFIX.'books.category_id)';
return $this->find( 'all', array( 'joins' => $join, 'order' => 'book_name ASC' ) );
}// list_books
}

and here is the page that call to model
$book = new Book();
$list_books = $book->list_books();
?>

<tr>
<td><input type="checkbox" name="id[]" value="id; ?>"></td>
<td>category_name; ?></td>
<td>book_name; ?></td>
<td><a href="edit.php?book_id=id; ?>">Edit</a></td>
</tr>

i cannot use $row->category_name as always do.
how to echo category_name with join table

show me the sample please.
thank you.