PHP and MySQL problem
How do I enter the plus(+)
and minus(-)
signs into a MySQL database and o开发者_JAVA百科utput them + -
as normal all while still using mysqli_real_escape_string();
if there is a better way please let me know.
What input/output are you actually getting? Whats the column type in the db for where you are trying to insert these?
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.
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
精彩评论