March 14th, 2000, 11:07 AM
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?
March 14th, 2000, 11:33 AM
The problem is that you have to URL-encode your search. This page for instance has the following URL:
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:
March 15th, 2000, 10:51 PM
thanks, i used urlencode and it works fine now, thanks again!