My setup is as follows:
Table 'data': 'title','body',...,'user_id',...
Table 'users': 'user_id','some_val'...
Basically I want to somehow join the tables 'data' and 'users' on the user_id field so that I can pull 'some_val' from the 'users' table. My problem is that not every user_id in the 'data' table has a corresponding entry in the 'users' table.
With codeigniter/php I ultimately want to assemble a results array of values containing all the 'some_vals' from the 'users' table joining data.user_id = users.user_id
. BUT when there exists a user_id in the data table but NOT in the users table, I want to insert some default value into my results array (and hopefully this array can be in the same order as the user_id's in the data table).
Hopefully this wasn't too unclear. Any ideas?