Welcome Guest, Not a member yet? Register   Sign In
Been trying to find the solution! (help with database)
#1

[eluser]Unknown[/eluser]
Lets say i have a table with three fields:

user_id , the session->userdata('id')
friend_id
are_friends , is a boolean

now i want to grab every id in the field user_id that is equal to session->userdata('id'),
because every individual row is connected with a single friend_id.

if this is confusing here is an example

i logged in as john with the id 34,
i have 4 entries that have the user_id as '34', the friend_id number of each one of them is
5,12,28,13
and are_friends boolean = 1, in all of them.

now i want to write in my model that if they are friends,

then i want to grab all the numbers in the friend_id field that are connected to the same user_id field. AND place them in a new table which i called "new"

this "new" table would have 2 fields

one with the user id and the other field stores all the numbers into a single entry (if that makes sense),

the problem is i also have no idea of how to setup a table that allows multiple numbers (or strings) in one entry.

i know this sounds confusing as i really don't know how to explain it well but any help would be great.


Messages In This Thread
Been trying to find the solution! (help with database) - by El Forum - 06-29-2010, 05:33 AM
Been trying to find the solution! (help with database) - by El Forum - 06-29-2010, 05:46 AM
Been trying to find the solution! (help with database) - by El Forum - 06-29-2010, 05:58 AM
Been trying to find the solution! (help with database) - by El Forum - 06-29-2010, 06:06 AM
Been trying to find the solution! (help with database) - by El Forum - 06-29-2010, 07:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB