tags:

views:

23

answers:

3

I am trying to insert couple of words in mySql database via php with flash interface. Since the words are in foreign language some of the letters are typed as ' and ". When I try to insert these letters I get error from mySql/php.

Can letter(symbols) like mentioned above be inserted in mySql? If yes, what changes do I need to make (Actionscript, PHP, mySql). The data type in mySql is varChar.

A: 

Try escaping them with a backslash (\). Replace ' with \' and " with \"

Fosco
There are functions for that. It's not a good idea to try and do this manually.
Pekka
and there are other characters that ought to be escaped
Col. Shrapnel
A: 

In your mysql query use this function - http://www.php.net/manual/en/function.mysql-real-escape-string.php.

PHPology
That depends on which mysql wrapper he is using.
Pekka
A: 

Use mysqli_real_escape_string (or mysql_real_escape_string).

Brian Hooper
AS codess_btn.addEventListener(MouseEvent.CLICK, callPhp);function callPhp(e:MouseEvent):void{ var urlR:URLRequest = new URLRequest("site.php"); var urlL:URLLoader = new URLLoader(); var urlV:URLVariables = new URLVariables(); urlV.nepali = nepali_txt.text; urlR.method = URLRequestMethod.POST; urlR.data = urlVariables; urlL.addEventListener(Event.COMPLETE, g); urlL.load(urlRequest);function g(e:Event):void{ var urlLR:URLLoader = URLLoader(e.target); var VR:URLVariables = new URLVariables(urlLR.data); if(VR.answer == "Yes") { }}
rex
php code<?php $nepali = $_POST['nepali']; $connection = mysql_connect("localhost","root",""); mysql_select_db("nepaliHangman",$connection); $query = "INSERT INTO words(`nepali`) VALUES ('$nepali')"; $result = mysql_query($query); if(!$result) { echo " } else { echo " }?>
rex
I looked through we debugging proxy and it show that the values of ' and " are sent as %27 and %22
rex