submarinefreak Posted April 9, 2010 Share Posted April 9, 2010 hi i'm submarinefreak and i'm from holland, i ocured this problem when i put my site online: i build a system where i can change messages using tinymce, and then is wil be put in the database. but the minute i pres my submit button, everywhere there are slahses (//) coming... does anyone know the answer to this problem? greetings from holland Link to comment https://forums.phpfreaks.com/topic/198086-slash-problem/ Share on other sites More sharing options...
TeddyKiller Posted April 9, 2010 Share Posted April 9, 2010 It's hard to help you, without duplicating the problem. Does your webserver or whatever your running the site online with, support PHP ? Link to comment https://forums.phpfreaks.com/topic/198086-slash-problem/#findComment-1039481 Share on other sites More sharing options...
submarinefreak Posted April 9, 2010 Author Share Posted April 9, 2010 yea it does, everything else works i only have that problem... greetz Link to comment https://forums.phpfreaks.com/topic/198086-slash-problem/#findComment-1039486 Share on other sites More sharing options...
TeddyKiller Posted April 9, 2010 Share Posted April 9, 2010 Could you post the code? Link to comment https://forums.phpfreaks.com/topic/198086-slash-problem/#findComment-1039489 Share on other sites More sharing options...
the182guy Posted April 9, 2010 Share Posted April 9, 2010 Problems with slashes when using WYSIWYG editors like TinyMCE are common, the problem usually lies in the part of your code that is trying to escape the HTML string (which will have lots of quotes in). You can solve that by using mysqli prepared statements to insert/update the HTML content. When using mysqli prepared statements there is no need to escape your input strings because it is automatically handled for you. Link to comment https://forums.phpfreaks.com/topic/198086-slash-problem/#findComment-1039522 Share on other sites More sharing options...
submarinefreak Posted April 12, 2010 Author Share Posted April 12, 2010 i am using a function for this: it goes wrong by the MESSAGE function updateUserById($bericht_id,$formdata) { //voer een update uit in de database voor een bepaald bericht $sql = sprintf("UPDATE berichten SET bericht_id = '%s', titel = '%s', message = '%s' WHERE bericht_id = '%s'", MYSQL_REAL_ESCAPE_STRING($formdata['bericht_id']), MYSQL_REAL_ESCAPE_STRING($formdata['titel']), MYSQL_REAL_ESCAPE_STRING($formdata['message']), MYSQL_REAL_ESCAPE_STRING($bericht_id)); $result = MYSQL_QUERY($sql); if (!$result) { $melding = "\t<li>bericht aanpassen is mislukt".PHP_EOL; } else { $melding = "\t<li>bericht is succesvol aangepast!".PHP_EOL; } return $melding; } greetz Link to comment https://forums.phpfreaks.com/topic/198086-slash-problem/#findComment-1040210 Share on other sites More sharing options...
TeddyKiller Posted April 12, 2010 Share Posted April 12, 2010 1- MYSQL_REAL_ESCAPE_STRING should be lowercase. (Doesn't make a whole lot of difference, but thats the way it should be) As for .. "\t<li>bericht aanpassen is mislukt" What is the \t ? Link to comment https://forums.phpfreaks.com/topic/198086-slash-problem/#findComment-1040224 Share on other sites More sharing options...
submarinefreak Posted April 12, 2010 Author Share Posted April 12, 2010 1- MYSQL_REAL_ESCAPE_STRING should be lowercase. changed it As for .. "\t<li>bericht aanpassen is mislukt" What is the \t ? i removed that and nothing happened so i think it was a writing error Link to comment https://forums.phpfreaks.com/topic/198086-slash-problem/#findComment-1040239 Share on other sites More sharing options...
submarinefreak Posted April 12, 2010 Author Share Posted April 12, 2010 SOLVED! in stead of using mysql_real_escape_string i used stripslashes and now it works! thanks for al the help greetings from holland Link to comment https://forums.phpfreaks.com/topic/198086-slash-problem/#findComment-1040271 Share on other sites More sharing options...
TeddyKiller Posted April 12, 2010 Share Posted April 12, 2010 Ah, if you had told me the slashes came from the actual strings itself then I'd of been able to tell you this Link to comment https://forums.phpfreaks.com/topic/198086-slash-problem/#findComment-1040273 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.