Inserting and retrieveing special characters in Mysql using php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ravigandha
    New Member
    • Mar 2008
    • 17

    Inserting and retrieveing special characters in Mysql using php

    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("in sert 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?
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Have you used the[php]mysql_escape_st ring()[/php] command on the $data variable before inserting?

    Ronald

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      Originally posted by ronverdonk
      Have you used the[php]mysql_escape_st ring()[/php] command on the $data variable before inserting?

      Ronald
      [php]
      mysql_escape_st ring()
      [/php]
      Is deprecated. Instead use
      [php]
      mysql_real_esca pe_sting()
      [/php]

      Comment

      Working...