[eluser]01010011[/eluser]
Hi,
I am using CI + Doctrine + MySQL and I am getting the following CRUD errors:
1. When trying to create a new record in the database with this code:
Code:
$book_title = 'The Peloponnesian War';
$b = new Book();
$b->title = $book_title;
$b->price = 10.50;
$b->save();
I get this error:
Quote:Fatal error: Uncaught exeption 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'title' in 'field list' in ...
2. When trying to fetch a record from the database and display on my view page with this code:
Code:
$book_title = 'The Peloponnesian War';
$title = $book_title;
$search_results = Doctrine::getTable('Book')->findOneByTitle($title);
echo $search_results->title; (in view file)
I get this error:
Quote:Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[45S22]: Column not found: 1054 Unknown column 'b.id' in 'field list" in ...
And finally, when I try to update a record as follows:
Code:
$book_title = 'The Peloponnesian War';
$title = $book_title;
$u = Doctrine::getTable('Book')->find($title);
$u->title = $title;
$u->save();
I get a similar error:
Quote:Fatal error: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'b.id' in 'field list''in ...
I have attached my doctrine model, controller and view php files and my database.sql file.
Any assistance will be really appreciated. Thanks in advance.