Welcome Guest, Not a member yet? Register   Sign In
Get data from two tables in single foreach
#2

(This post was last modified: 07-19-2018, 06:45 AM by Pertti.)

Because comment is only made by one user, I think it wouldn't be wrong to move user_id itself to comment, however this is what you could do with ->

PHP Code:
$query $this->db
    
->select('ci_comments.*, ci_users.user_id, ci_users.username')
    ->
where('ci_comments.comment_id''ci_relationship.comment_id'false)
    ->
where('ci_relationship.user_id''ci_users.user_id'false)
    ->
get('ci_commetns, ci_relationship, ci_users'); 
Reply


Messages In This Thread
RE: Get data from two tables in single foreach - by Pertti - 07-19-2018, 06:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB