SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Apr 2001
    Location
    None
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello guys,

    I'm trying to do a query with an ampersand (&) in the string, but it doesn't work because the (&) sign was meant to be as a "join", for example page.php?one=10&two=20

    In the MySQL database the keyword is "some word & the other"

    When I display it in a string: "page.php?name=some word & the other"

    And am trying to display "$name" on a page, I only get "some word" and miss everything after an ampersand sign.

    And when I try to pull some records out of the database based on the above string, I get an error. Any ideas on how to fix it?

    I'd gladly edit my database to change "&" to "and" but I have over 2,000.000.00 records.

  2. #2
    SitePoint Columnist Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,066
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to urlencode the value before passing it to the query string - use this function:

    www.php.net/urlencode


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
  •