|
-
March 30th, 2010, 03:16 PM
#1
insert # sign to mysql and also pass it through ajax url
How can i insert # sign into the database? Do i have to use a different collation?
Also cannot pass both & and # signs through the ajax url to the php file, any work around that excepting for replacing it with delimiters?
-
March 30th, 2010, 06:24 PM
#2
Re: insert # sign to mysql and also pass it through ajax url
Remember that & and # are URL string delimiters. You have to URL encode/decode them.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
March 31st, 2010, 10:30 AM
#3
Re: insert # sign to mysql and also pass it through ajax url
 Originally Posted by PeejAvery
Remember that & and # are URL string delimiters. You have to URL encode/decode them.
How would i do that?
I mean lets say in my query i have a certain text field which contains #
Code:
$qry = "insert into xyz values(null, '#1 Fan Image')";
Do you mean i should urlencode('#1 Fan Image'); ??
and while retrieving it decode it?
would it have an adverse effect if the string did not contain any special characters, i mean i donot want to search for a special character and encode it only on its existance.
-
April 1st, 2010, 09:53 AM
#4
Re: insert # sign to mysql and also pass it through ajax url
Use JavaScript's encodeURI() to pass it through the AJAX call. Then, use PHP's urldecode() on just the variable for the query string.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
April 2nd, 2010, 11:46 AM
#5
Re: insert # sign to mysql and also pass it through ajax url
 Originally Posted by PeejAvery
Use JavaScript's encodeURI() to pass it through the AJAX call. Then, use PHP's urldecode() on just the variable for the query string.
encodeURI seems to work only for urls. But my issue is if i am passing some to be inserted into the db on an ajax call i would want the user to put in special characters like # and & as well. using encodeURI is not good for this.
-
April 3rd, 2010, 09:39 PM
#6
Re: insert # sign to mysql and also pass it through ajax url
So are you only sending as POST and not GET?
 Originally Posted by [email protected]
i would want the user to put in special characters like # and & as well. using encodeURI is not good for this.
encodeURI would not affect inputing special characters into the database at all if you remembered to decode them on the server-side...as I suggested.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|