Jump to content

slash problem


submarinefreak

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.