#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    13
    Rep Power
    0
    i've ran in to a problem with the "&" character in the database i'm developing. when i add a name to the database something like "tom & jerry" it's stored in the table under the name field.

    when i do a search for it, it'll show up in the results. a link will show up for it, but when you click the link it won't retrieve the data, saying it's not in the database. when i tried to fix it, i just got it to print out what the value is and i got just "tom" the "& jerry" part was missing.

    i', assuming php is taking the & for a logical & operator, how do i fix this?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 1999
    Location
    Helden,Limburg,The Netherlands
    Posts
    33
    Rep Power
    16
    The problem is that you have to URL-encode your search. This page for instance has the following URL:
    http://www.devshed.com/cgi-bin/ubb/p...QUT|+character

    Everytime a & is encountered it is enterpreted as a new key-value pair. So Tom&Jerry will cause an error if this is not encoded. You can check the PHP manual for the functions:

    -urlencode
    -urldecode
    -rawurlencode
    -rawurldecode

    Success.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    13
    Rep Power
    0
    thanks, i used urlencode and it works fine now, thanks again!

Similar Threads

  1. w3c strict errors (10), css, and js questions
    By WorldBuilder in forum CSS Help
    Replies: 12
    Last Post: November 6th, 2003, 05:48 AM
  2. Reading only one character from stdin.
    By coredumped in forum C Programming
    Replies: 2
    Last Post: May 11th, 2003, 06:10 PM
  3. read string character by character
    By Rooseboom in forum PHP Development
    Replies: 3
    Last Post: January 7th, 2002, 11:35 AM
  4. Mysql + PHP and the ' character == problems;
    By goodfella in forum PHP Development
    Replies: 3
    Last Post: October 21st, 2000, 02:19 PM

IMN logo majestic logo threadwatch logo seochat tools logo