hello everyone!

i'm trying to display a text from my database, that part is already fine but when the value of the text has a - or ' (maybe there's more) in it, instead of displaying the actual - or ' it displays other special char like smileys and stuff.

so ahmm how do i fix this?

i'm using nl2br before placing it to the database btw...

THX!

hello everyone!

i'm trying to display a text from my database, that part is already fine but when the value of the text has a - or ' (maybe there's more) in it, instead of displaying the actual - or ' it displays other special char like smileys and stuff.

so ahmm how do i fix this?

i'm using nl2br before placing it to the database btw...

THX!

You should probably try it on another computer to make sure it is not some type of spyware.

whether u r inserting values into the table manually or through the code
commented: Not helpful (doesn't make sense) and why code tags? -1

You need to back slash those charachters before they are stored in the database.

Do a search for maqic quotes in php or mysql there a couple of them out there that will do the job. I am at work otherwise I will send you the one I use.

You need to back slash those charachters before they are stored in the database.

Do a search for maqic quotes in php or mysql there a couple of them out there that will do the job. I am at work otherwise I will send you the one I use.

//Create a function for escaping the data 
function escape_data ($data) {
		global $dbc; //need the connection.
		if ('get_magic_quotes_gpc'){
		$data = stripslashes($data);
		}
		$data = trim($data);
		return mysql_real_escape_string($data, $dbc);
		}// End Function
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.