I have an activity table with 3% reference keys. I need connection information from this identifier, that is, to display the text of comments - I do not want to store the text twice ... (the same for mail and subject).
Action Table: id | post_id | comment_id | topic_id
Each line contains only post_id OR comment_id OR topic_id, the other two id fields are NULL.
So, if post_id = 55, comment_id = NULL, topic_id = NULL, I get the following:
Array ( [0] => Array ( [Activity] => Array ( [id] => 1 [post_id] => 55 [comment_id] => [topic_id] => ) [Post] => Array ( [id] => 55 [name] => Post
Is there a way to join only if the reference identifier is NOT NULL? I don't want to kill empty arrays after searching with php for each loop.
Another idea is a database table: id | activitytype_id | refid to combine with dynamic linking of the required table depending on activitytype_id. - It didn't work ...
What do I want - is it possible?
Array ( [0] => Array ( [Activity] => Array ( [id] => 1 [post_id] => 55 [comment_id] => [topic_id] => ) [Post] => Array ( [id] => 55 [name] => Post
Thanks in advance!: -)
shoemakerlevy9
source share