Jump to content

Comparing Two Values (Arrays)


PattyB

Recommended Posts

I am trying to compare the values of two things.

The first set of values comes from a multi-select and outputs like this:  item1,item2,item3,  and etc. for however many options I choose.  I am not sure if this needs to be converted into an array or if it can stay like is?

The second set of values comes from a mysql table.  Say this table contains two fields: email and groups.

What I want to do is compare the first output (item1,etc) to the value of what is in the field groups and have an if statement if there is a match.

For example:  I have a list of users in a table along with their email and groups they belong to.  The user will select the groups they want from a multi-select.  I want to compare the groups selected to the groups each user belongs too and if there is a match to do something.

Im guessing array_intersect can play a role in this but I have been playing for a while and cant get anything to work. 

Any help would be very grateful.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.