By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,934 Members | 1,449 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,934 IT Pros & Developers. It's quick & easy.

Inserting and retrieveing special characters in Mysql using php

P: 17
Hello everybody,
My question is how to insert special characters and symbols in Mysql5 database and how to retrieve them from database in php.
Here i am inserting some data from a form,by post method like
[PHP]$data=$_post[''field name"];[/PHP]
after this i am inserting in database,
[PHP]mysql_query("insert into tbl_name(column name) values('$data')");[/PHP]
Everthing working fine when we insert simple text in the form,but failing when special character are entered. eg: "",&,("some text").
And onemore thing i want to insert some mathematical equations or chemical equations into database how?
Mar 10 '08 #1
Share this Question
Share on Google+
2 Replies


ronverdonk
Expert 2.5K+
P: 4,258
Have you used the[php]mysql_escape_string()[/php] command on the $data variable before inserting?

Ronald
Mar 10 '08 #2

Markus
Expert 5K+
P: 6,050
Have you used the[php]mysql_escape_string()[/php] command on the $data variable before inserting?

Ronald
[php]
mysql_escape_string()
[/php]
Is deprecated. Instead use
[php]
mysql_real_escape_sting()
[/php]
Mar 10 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.