MySQLi -> How to select only one item from the list

Discussion in 'MySQL' started by ketting00, Jul 1, 2011.

  1. #1
    Hi,

    I have a serious problem. The bellow code select every thing from the column email:

    
    if ($result = $mysqli->query("SELECT email FROM users ORDER BY 1"))
    
    Code (markup):
    It's ok if the conditional statement is matched. But it returns all over 2 thousands of my users emails as not found if there is no email is matched with which stored in the database. I've changed code as bellow:

    
    if ($result = $mysqli->query("SELECT email FROM users WHERE email = $email"))
    
    Code (markup):
    It does not work.

    Thanks in advance
     
    ketting00, Jul 1, 2011 IP
  2. ketting00

    ketting00 Well-Known Member

    Messages:
    782
    Likes Received:
    28
    Best Answers:
    3
    Trophy Points:
    128
    #2
    Never mind I can managed to get it worked.
     
    ketting00, Jul 1, 2011 IP