How to Remove users in user table with certain email ?

Discussion in 'PHP' started by MightyMann, Jan 21, 2008.

  1. #1
    Hi,
    I have a DB which include a Table “users” which have fields
    userID userUsername userPassword userFirstName userLastName userEmailAddress userLastAccountAccess userDateRegistered userStatus userPrivliges userAccountType userAddressStreet userAddressZIPCode userAddressCity userAddressState userDateOfBirth userGender userPublicProfile userCreditBalance userReferralID
    I have a Text file with a list of bad emails one email per line
    I need a Simple script that I can insert db name , un and pw and upload and run to remove all user’s who have email matching one in the bad email list.
    I am trying to clean my newsletter of bad email users, bonusback or unsubscribers etc.
    Any help is appreciated
     
    MightyMann, Jan 21, 2008 IP
  2. logondotinfo

    logondotinfo Peon

    Messages:
    314
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #2
    ok, not sure what format your bad list is in, but for each row in bad list, define the bad address as $bad, simply use following php query - EXAMPLE ONLY, will need tweaking, and will also need your db connection establishing before this is declared in your script.
     
    logondotinfo, Jan 21, 2008 IP
  3. MightyMann

    MightyMann Peon

    Messages:
    83
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I always find out some solution
    DELETE FROM users WHERE (userEmailAddress='p*****@aol.com');
    I just have to repeat this 4 - 500 times for each mail
     
    MightyMann, Jan 21, 2008 IP
  4. MightyMann

    MightyMann Peon

    Messages:
    83
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks logo it worked in loop
     
    MightyMann, Jan 21, 2008 IP
  5. GoglGourd

    GoglGourd Active Member

    Messages:
    122
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #5
    don't need the () around useremail, this would work just as well

    DELETE * FROM users WHERE userEmailAddress='blahblah@gmail.com';
     
    GoglGourd, Jan 22, 2008 IP
  6. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Don't need the * either.
     
    SmallPotatoes, Jan 22, 2008 IP
  7. GoglGourd

    GoglGourd Active Member

    Messages:
    122
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #7
    Ahh sehr suave, cheers suppose. these things are all force of habbit
     
    GoglGourd, Jan 23, 2008 IP