Hello,
So i have seen this been done (while back) but as of now i cant remember how i can get the info from the database.
So basicly i have an database that have the following info:
I'm confused. Sounds like you just want to SELECT users and display their Id and Name? Since you've shown no code exactly what do you need help with?
it is just a quesstion, didnt feel i needed to give the code for this.
Basicly, i have a user table and a group table,
UserID's is is sotred under the row "members" in the Group table. And since i am storing the info like this: (1 , 2 , 3, 4 ) in the members table.
So basicly
the code i have looks like this:
$rows["members"] will never equal $users1["id"]. To be honest I would redesign the database. But, assuming you don't want to redesign your database then you need to convert $rows["members"] into an array (see explode command) then use PHP command in_array to check each value in the array against $users1["id"].
Example:
$members = explode(", " , $rows["members"]);
if(in_array($users1["id"], $members))
{
echo $users1["name"];
}
else
{
echo "[ERROR: No Match Found in our Database]";
}
This code is untested but should get you started.
Also, if members doesn't contain comma space ", " then the above code will fail.
Or, you can forget about the array plan and try this instead. Just use 'strpos' to test for $users1["id"]. Example:
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)