Jump to content

simonmcm

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

simonmcm's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have checked that, the problem is the SQL statement isn't returning the output as an array, whats the syntax to output the result as an array?????
  2. Hi I am using the ZEND FRAMEWORK and for some reason the results from this SQL statement aren't being displayed in the table: The query in the database model is as follows: public function getUsersBooks($userName) { $select = $this->select() ->from('books', array('title', 'author')) ->where('username = ?' ,$userName); $result = $this->getAdapter()->fetchAll($select); return $result; The controller is as follows: public function indexAction() { $this->authoriseUser(); $session = new Zend_Session_Namespace('MyNamespace'); $userName = $session->username; $books = new Model_DbTable_Books(); $this->view->books = $books->getUsersBooks($userName); } And the view is as follows: <table> <tr> <th>Title</th> <th>Author</th> </tr> <tr> <?php foreach($this->books as $book) : ?> <td><?php echo $this->escape($book->title);?></td> <td><?php echo $this->escape($book->author);?></td> <?php endforeach; ?> </tr> </table> if any one has any ideas why the results of the statement arnt being displayed it will be much apriciated
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.