Saturday, July 4, 2009

generateList() returning SQL error.

my db is designed as one author can have many books. books belongsto
authors. when i call generateList() i get a 1064 SQL error.

here is my add action:

public function add() {
if(!empty($this->data)) {
$this->Book->create();
$this->Book->save($this->data);
$this->redirect(array('action' => 'index'));
}
$authors = $this->Book->Author->generateList();
$this->set('authors', $authors);
}

and my view:

<?php echo $form->create('Book'); ?>
<fieldset>
<legend>Add a new book:</legend>
<?php
echo $form->input('isbn');
echo $form->input('title');
echo $form->input('description');
echo $form->input('author_id');
?>
</fieldset>
<?php echo $form->end('Submit'); ?>

the error msg is:
1064: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'generateList' at line 1

im using xampp on win xp so im guessing everything is up to date. my
db_config uses mysqli.

any ideas? thanks in advance for response.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: