richiejones24 Posted September 25, 2012 Share Posted September 25, 2012 (edited) I run data through mysql_real_escape_string() before using implode() but implode() is removing 1 of the \ after mysql_real_escape_string() has put them in. If anyone you could let me know how i could stop this i would be great. Thanks Edited September 25, 2012 by richiejones24 Quote Link to comment https://forums.phpfreaks.com/topic/268793-implode-removing-from-mysql_real_escape_string/ Share on other sites More sharing options...
Jessica Posted September 25, 2012 Share Posted September 25, 2012 implode does not affect the values within the array. Post the code. Quote Link to comment https://forums.phpfreaks.com/topic/268793-implode-removing-from-mysql_real_escape_string/#findComment-1380910 Share on other sites More sharing options...
ManiacDan Posted September 25, 2012 Share Posted September 25, 2012 Better yet, post code that proves this is happening, along with the output. Quote Link to comment https://forums.phpfreaks.com/topic/268793-implode-removing-from-mysql_real_escape_string/#findComment-1380911 Share on other sites More sharing options...
richiejones24 Posted September 25, 2012 Author Share Posted September 25, 2012 (edited) MySql Values after implode() '140 Church Street','St John\'s Wood','London','NW8 8EX' MySql Values before implode() '140 Church Street','St John\\'s Wood','London','NW8 8EX' The Code while ($f < count($AddressSplitBus)) { $AddressSplitBus[$f] = trim($AddressSplitBus[$f]); $AddressSplitBus[$f] = mysql_real_escape_string($AddressSplitBus[$f]); $f++; } //Create the Values to insert into DB $MysqlValuesBus = implode("','", $AddressSplitBus); $MysqlValuesBus = "'$MysqlValuesBus'"; $NumberValsBus = count($AddressSplitBus); Again Thanks for the help guys Edited September 25, 2012 by richiejones24 Quote Link to comment https://forums.phpfreaks.com/topic/268793-implode-removing-from-mysql_real_escape_string/#findComment-1380913 Share on other sites More sharing options...
Barand Posted September 25, 2012 Share Posted September 25, 2012 Your values before the implode should look like the values that you get after. It looks as though you are escaping data that has already been escaped. Have you checked that magic_quotes are not on? Quote Link to comment https://forums.phpfreaks.com/topic/268793-implode-removing-from-mysql_real_escape_string/#findComment-1380921 Share on other sites More sharing options...
Jessica Posted September 25, 2012 Share Posted September 25, 2012 And how do you KNOW that is happening? There's nothing in your code that does an echo or dump of the data. Quote Link to comment https://forums.phpfreaks.com/topic/268793-implode-removing-from-mysql_real_escape_string/#findComment-1380938 Share on other sites More sharing options...
ManiacDan Posted September 26, 2012 Share Posted September 26, 2012 Right, this code proves nothing other than you still say something which most of us think is impossible. Barand is right, this data is already escaped by something. Though that has no bearing on implode() Quote Link to comment https://forums.phpfreaks.com/topic/268793-implode-removing-from-mysql_real_escape_string/#findComment-1380948 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.