scarhand Posted October 6, 2007 Share Posted October 6, 2007 I didnt know exactly where to put this so I posted it in PHP and AJAX forums I'm having problems passing an ampersand through AJAX to a database. htmlspecialchars will convert and send all other chars to the database, except ampersand heres my message variable before its inserted into the database: $message = mysql_real_escape_string(htmlspecialchars($_POST['message'], ENT_QUOTES)); is there any other php procedures that I could use so that my AJAX script will pass ampersands into the database? Quote Link to comment Share on other sites More sharing options...
bobleny Posted October 7, 2007 Share Posted October 7, 2007 You could try this: $_POST['message'] = str_replace('&', '&', $_POST['message']); $message = mysql_real_escape_string(htmlspecialchars($_POST['message'], ENT_QUOTES)); Good luck! Quote Link to comment Share on other sites More sharing options...
markjoe Posted October 23, 2007 Share Posted October 23, 2007 I've never run into this problem, but it occurs to me that you could use the ascii code to make the transit and then back to the character to make the comparison. Just a thought, seems simple enough. 2 PHP functions of interest: ord() chr() Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.