For once, I've completely stumped myself.

Discussion in 'PHP' started by chuckd1356, Oct 9, 2007.

  1. #1
    So I must be having an "off" programming day, because I cannot get this right for the life of me. Here's what I'm dong.
    A user is registering, and their username is already taken, so along with redirecting them back to the form with an error message, I'm making some "random" usernames as a suggestion.
    The random user names are kept in $username_rand[]. But before I offer them to the user, I of course have to make sure they're not taken, so I'm pulling all the user names out of the DB. Now my question, is how the hell do you make sure that none of the elements in one array are in another array?
    I've tried in_array, but it never seems to work. Does anyone know how to do this?

    BTW, there's no need for source code. Two variables, pretty straight forward. And don't bust your ass on this by writing nice, secure code, I'm certainly no C&P'er. I just need a point in the right direction.

    And rep of course. Thanks guys and gals. :eek:
     
    chuckd1356, Oct 9, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    nico_swd, Oct 9, 2007 IP
    chuckd1356 likes this.
  3. chuckd1356

    chuckd1356 Active Member

    Messages:
    770
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    70
    #3
    Yup, exactly what I needed. Thanks.
     
    chuckd1356, Oct 9, 2007 IP