tags:

views:

45

answers:

3

How do I enter the plus(+) and minus(-) signs into a MySQL database and output them + - as normal all while still using mysqli_real_escape_string(); if there is a better way please let me know.

A: 

When looking at the mysqli_real_escape_string() documentation, I do not think that the + and - characters are escaped. Only NUL (ASCII 0), \n, \r, \, ', ", and Control-Z are escaped according to that page.

So I suppose you need to provide more information about your problem.

Veger
A: 

What input/output are you actually getting? Whats the column type in the db for where you are trying to insert these?

prodigitalson
I'm getting nothing for example an A- will produce nothing at all.
burger
whats the column type?
prodigitalson
A: 

I use mysql_real_escape_string() and set your charset for the table or row as latin1 utf8 might be a better choice though...

Could also play around with the different encodings urlencode() and such.

//encode the update in case of & and other characters that will break twitter API $update = '%E2%99%AB'.urlencode($update);

%E2%99%AB creates the 'musical note symbol`

http://www.eskimo.com/~bloo/indexdot/html/topics/urlencoding.htm

ian
A minor gripe but I think you mean `utf8` not `uft8`...
Josh
True true... fixed.
ian