SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Case Insensitive for mySQL Query!

    Hi,

    I've been uin gthe following code to verify if the user account exists.

    PHP Code:
    $result mysql_query("SELECT access, status FROM tablename WHERE identification='$ident' AND PASSWORD('$pass')=password");
    $numrows mysql_num_rows($result); 
    However, i just realised that
    lynlimz and lYnLimz are taken to be the same! how do I make sure its case sensitive?

    thanks
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  2. #2
    SitePoint Zealot alexk's Avatar
    Join Date
    Nov 2000
    Location
    Sydney, Australia
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you mean your identification column values should be case sensitive?... if so, what is its type?... for char/varchar you should use BINARY attribute...

  3. #3
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its varchar...what do you mean by binry?
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  4. #4
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yicks. Okay. Thanks. I got it working.

    Now..what fields should be binary/unsigned/unsigned zerofill?
    it seems theres more to creating tbales with the respective fields! yicks!

    is there any article on creating proper tables with fields not compromising security?

    thanks
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  5. #5
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by lynlimz
    Now..what fields should be binary/unsigned/unsigned zerofill?
    it seems theres more to creating tbales with the respective fields! yicks!

    is there any article on creating proper tables with fields not compromising security?
    BINARY is for text types. UNSIGNED and ZEROFILL are for INT types. UNSIGNED means negative values aren't allowed (good for AUTO_INCREMENT cols). ZEROFILL means your number will be left padded, if necessary, with 0s to the length you specified when you created the column.
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  6. #6
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    whats the advantages of zerofill?

    also, whhats the suitable number of characters for a specifici field?
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  7. #7
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by lynlimz
    whats the advantages of zerofill?
    maybe you'd want your number to always be a certain length, which ZEROFILL can help with. i.e. instead of 1, 2, 37, 573, you might want 000001, 000002, 000037, 000573.

    also, whhats the suitable number of characters for a specifici field?
    i don't know what you mean...

  8. #8
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah..icic..okay.

    i mean..how many characters for fields such as email...username etc.?
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  9. #9
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by lynlimz
    i mean..how many characters for fields such as email...username etc.?
    you mean the length for x in VARCHAR(x)? well whatever you want or think is enough. it doesn't really matter. i would use, say, 30 for a username, and maybe 50 for an email addy. but if you think you'd want/need longer, just make them longer.

  10. #10
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah. cool.
    thanks
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  11. #11
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no problem.


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
  •