I have 2 tables. The parent table is learn_mor
e and child table is reference_keys
Both tables are innodb
reference_keys has two columns:
key_id [index]
key_href
learn_more table
id [primary]
keys_id [foreign key]
page_title
page_content
What I am trying to do is get multiple links in the learn more table from the reference_keys table. So example, learn_more table id:1, keys_id:1,3,4,8,13,25,..., page_title:Home Page: blah blah, page_content: blah blah......
The problem is that phpmyadmin will not allow me to put more than 1 id in the keys_id of learn_more.
//ERROR
//Warning: #1265 Data truncated for column 'keys_id' at row 1
I'm guessing the relation view is not setup correctly. - How do i fix this?
and on my page it shows the key_id in the echo instead of the value for the id: which is the key_href. so my page show "1" instead of the value for 1 which is a link..
Perhaps my sql query is not correct?
$SQL = "SELECT * FROM learn_more WHERE page_title = '$this_page'";
reference_key
can be referenced by manylearn_more
but eachlearn_more
may only reference onereference_key
. Are you looking instead for a many-to-many? – ametren Jul 11 '12 at 17:12