mark_nsx Posted November 3, 2006 Share Posted November 3, 2006 Hi there!I'd just like to know how to insert the & character into a mysql DB? say i have to inserta string that contains &.. thanks very much! Link to comment https://forums.phpfreaks.com/topic/26038-dealing-with-the-ampersand-character-in-phpmysql/ Share on other sites More sharing options...
mark_nsx Posted November 3, 2006 Author Share Posted November 3, 2006 for example.. "Management & Staff" Link to comment https://forums.phpfreaks.com/topic/26038-dealing-with-the-ampersand-character-in-phpmysql/#findComment-119045 Share on other sites More sharing options...
HuggieBear Posted November 3, 2006 Share Posted November 3, 2006 Use [url=http://uk.php.net/manual/en/function.htmlentities.php]htmlentities()[/url] on the text you want to put into the database, this will convert the & to &RegardsHuggie Link to comment https://forums.phpfreaks.com/topic/26038-dealing-with-the-ampersand-character-in-phpmysql/#findComment-119047 Share on other sites More sharing options...
mark_nsx Posted November 3, 2006 Author Share Posted November 3, 2006 btw those values are gotten from a <select> list then passed to the $_REQUEST[] array, along with a bunch of other variables, then onto the handling script.. i think the script gets confused when it encounters the & character.. for instance..post.php?var1=Management & Staff&var2=Legal... Link to comment https://forums.phpfreaks.com/topic/26038-dealing-with-the-ampersand-character-in-phpmysql/#findComment-119053 Share on other sites More sharing options...
HuggieBear Posted November 3, 2006 Share Posted November 3, 2006 Yes, that's exactly what's causing the problem.RegardsHuggie Link to comment https://forums.phpfreaks.com/topic/26038-dealing-with-the-ampersand-character-in-phpmysql/#findComment-119056 Share on other sites More sharing options...
mark_nsx Posted November 3, 2006 Author Share Posted November 3, 2006 i need to somehow encode the string before it gets passed.. Link to comment https://forums.phpfreaks.com/topic/26038-dealing-with-the-ampersand-character-in-phpmysql/#findComment-119057 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.