SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast ericd's Avatar
    Join Date
    Nov 2000
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Im really puzzled, if the $username and $password are numbers, it will work, but if they are letters, it wont



    $sql =
    mysql_query("SELECT * FROM clients WHERE username=$username and password=$password");



    any idea why this doesnt work with letters?

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Because if the strings are letters you need single quotes around them its probably safest to just include single quotes around them all
    $sql = mysql_query("SELECT * FROM clients WHERE username=$username and password=$password");

    should be

    $sql = mysql_query("SELECT * FROM clients WHERE username='$username' and password='$password'");
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Enthusiast ericd's Avatar
    Join Date
    Nov 2000
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, where did you get your cat from?.


    I want one!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •