Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Posts
    477
    Thanks
    7
    Thanked 3 Times in 3 Posts

    what does # do in mysql string ?

    I am trying to find the next entry in one of the fields in my table after an entry with '#3' (without quotes) in it. But it keeps returning some other entry in the table and not the one after '#3'

    I feel it is something to do with the # but can not find anything on it.

    This is the sort of query i am using..

    Code:
    SELECT * FROM `mytable` WHERE `myfield` > '" . $mysqli->real_escape_string($string) . "' ORDER BY `myfield` ASC LIMIT 1
    Does the # do something with my string ?

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,118
    Thanks
    80
    Thanked 4,555 Times in 4,519 Posts
    Quote Originally Posted by needsomehelp View Post
    I am trying to find the next entry in one of the fields in my table after an entry with '#3' (without quotes) in it.
    There is no way you could have a field containing '#3' unless it *IS* a string.

    In other words, the apostrophes (quotes) *are* needed there.

    # has no special meaning in MySQL. It's just another character. It will be > '@' and < '$' just as you would expect.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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