Welcome Guest, Not a member yet? Register   Sign In
CI Doctrine MySQL CRUD errors
#1

[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.
#2

[eluser]Mareshal[/eluser]
I know that phpandstuff.com has articles about ci and doctrine, a lot. read there about doctrine models and how to setup them
#3

[eluser]01010011[/eluser]
[quote author="Mareshal" date="1272078021"]I know that phpandstuff.com has articles about ci and doctrine, a lot. read there about doctrine models and how to setup them[/quote]

Thanks for your reply.
Their tuts are excellent. I reached Day 5 Database CRUD and I've had no problems until now.




Theme © iAndrew 2016 - Forum software by © MyBB