Jump to content

[SOLVED] Can't use special characters.


erfg1

Recommended Posts

I made a bug report script so people can report them, and an administrator could read them, and edit them.

 

However, if someone reported something and put a special character like ' when i would go to edit and re-submit, it would say that its a syntax error. I've fixed this in my previous scripts however, i lost them, and can't recall how to do it. Basically I want to UPDATE.

 

Basically editing another field, but not their original report containing a ' and wanting to re-submit without editing their report.

 

$sql5 = "UPDATE cm_bugreport SET version = '$version', name = '$name_edit', bug = '$bug', status = '$status', comments = '$comments' WHERE id = '$id'";
		$db->sql_query($sql5);

Link to comment
https://forums.phpfreaks.com/topic/43054-solved-cant-use-special-characters/
Share on other sites

Is this right?

 

$sql5 = "UPDATE cm_bugreport SET version = '". mysql_real_escape_string($version) .", name = '$name_edit', bug = '$bug', status = '$status', comments = '$comments' WHERE id = '$id'";

 

Cause im still getting errors back.

 

EDIT: nvm, this is how it should be.

$sql5 = "UPDATE cm_bugreport SET version = '". mysql_real_escape_string("$version") ."', name = '$name_edit', bug = '$bug', status = '$status', comments = '$comments' WHERE id = '$id'";

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.