mks mks Fri May 27 13:49:54 -0400 2011

Subject: problems with associations

Hi, I got a similar problem to this topic: http://www.phpactiverecord.org/boards/1/topics/588-my-first-association

I got the following database:
"news" table
"tags" table
"news_has_tags" table - attributes: id, news_id, tags_id

and the following error-message:
Fatal error: Uncaught exception 'ActiveRecord\DatabaseException' with message '42S22, 1054, Unknown column 'news_id' in 'where clause'' in C:\xampp\htdocs\hobbi-floppi\php-activerecord\lib\Connection.php:276 Stack trace: #0 C:\xampp\htdocs\hobbi-floppi\php-activerecord\lib\Table.php(208): ActiveRecord\Connection->query('SELECT * FROM `...', Array) #1 C:\xampp\htdocs\hobbi-floppi\php-activerecord\lib\Table.php(199): ActiveRecord\Table->find_by_sql('SELECT * FROM `...', Array, false, NULL) #2 C:\xampp\htdocs\hobbi-floppi\php-activerecord\lib\Model.php(1428): ActiveRecord\Table->find(Array) #3 C:\xampp\htdocs\hobbi-floppi\php-activerecord\lib\Relationship.php(491): ActiveRecord\Model::find('all', Array) #4 C:\xampp\htdocs\hobbi-floppi\php-activerecord\lib\Model.php(493): ActiveRecord\HasMany->load(Object(News)) #5 C:\xampp\htdocs\hobbi-floppi\php-activerecord\lib\Model.php(386): ActiveRecord\Model->read_attribute('tags') #6 C:\xampp\htdocs\hobbi-floppi\views\news\view.php(9): ActiveRecord\Model->__get('tags') #7 C:\xampp\htd in C:\xampp\htdocs\hobbi-floppi\php-activerecord\lib\Connection.php on line 276

I adepted the solution from the other post, but i don't what to do with that error.

Any ideas?


mks mks Fri May 27 14:25:23 -0400 2011

ok, forget what i wrote - i did a spelling-mistake.
The solution in the other posts works fine for me.

(1-1/1)