Jump to content

Multiple Arrays and shifting data between them.


monkeytooth

Recommended Posts

Ok I have a hand full of Arrays

 

I have one that is built based on one query. That has name, email in pairs its a 3D array example

 

Array(
    [Errors] = none,
    [listed] = Array(
                        array(username1, email1)
                        array(username2, email2)
                        array(username3, email3)
                        array(username4, email4)
                        array(username5, email5)
                        array(username6, email6)
                        array(username7, email7)
                    )
        )

 

Off that same query I have another array that is just the email address's that I use to query my DB for to see if they are already in that DB.

 

array(email1,email2,email3,email4,email5,email6, email7)

 

I am querying my DB using the IN() function base off the emails in the second array shown above. This query will return email addresses already in my system. Now what I am trying to do overall is create 2 separate arrays. One that is a list of the username/email that's in the system the other that's a list of the username/email that's not in the system. Anyway the first array set I shown is the array I have to ultimately shuffle around.. I'm guessing something as simple as just removing any given array that's a matching email for already in the system leaving whats not in that array behind and using that as my "not in system" array. However it being a 3D array like it is I am stuck as to how I should approach this obstacle so I can remove the sets of data as needed and push them or whatever into another new array. So here I am looking for ideas and suggestions.

Link to comment
Share on other sites

You should reconstruct your first array so the username is the key and the email is the value. You can then use one of the array_dif() functions on the results of a query for matching emails. I think you are making this more complicated than it needs to be. It would be helpful to see some of the relevant code you have.

Link to comment
Share on other sites

actually just thought of something however.. sometimes the username to be displayed is the same as the email address.. or is empty.. in both cases I change it to "none" where when it comes to the display if that name is none.. then it shows slightly differently.. how would that effect me?

Link to comment
Share on other sites

actually just thought of something however.. sometimes the username to be displayed is the same as the email address.. or is empty.. in both cases I change it to "none" where when it comes to the display if that name is none.. then it shows slightly differently.. how would that effect me?

 

Your "question" is really just a generalized question since you haven't provided any code. There is an infinite number of ways to accomplish the same thing and I can't provide any relevant solutions without seeing some code.

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.