mysql - PHP can't receive a param from ActionScript3 -


I have created a website and have communicated with the ActionScript. In Actionscript I am creating a function to call a php function and to post a variable for data loaded from the mysql database. The problem is that when I php PHP script to function script and post variable Calling on the Php side, I call $ _POST ['action']; To get a variable from the action script, but when I want to see this post $ _POST ['action']; This kind of error

  Notice: Undefined index: Work in: \ wamp \ www \ MPA-EM \ bin \ model.FPP line3   < P> and this is an action script function for calling php:  
  PublicDocument (TBN: string, type: string): zero {var myrequest: URLRequest = new URLRequest ("http : // local host / MPA-EM / bin / model.php "); Myrequest.method = URLRequestMethod.POST; Var variable: URLVariables = new URLVariables (); Variables.tablename = TBN; Variables.action = TYPE; Myrequest.data = variable; Var loader: URL loader = new URL loader (); Loader.dataFormat = URLLoaderDataFormat.VARIABLES; Loader.addEventListener (event.complete, data download); Loader.addEventListener (event.cancel, data errors); Try {Loader.load (myrequest); } Hold (e: error) {alert.show (e.toString ()); }} Public Function Data Download (EVT: Event): zero {alert.show (evt.target.data.Result); If (evt.target.data.Result) {DText.text = 'OK'; } And DText.text = "error in selected submitted data"; // Status is a custom flag passed from back-end) Public Function Data Error (E: Event): Zero {DText.text = e.target.errormsg; }   

And this is a php function side model. Php:

  & lt ;? Php // test $ actionW = $ _POST ['for action']; // Error this line Echo $ $ actionW; // End test if (isset ($ _ POST ['action']) & amp; blank ($ _ POST ['action'])) {$ action = $ _POST ['action']; Now $ action; Switch ($ verb) {case 'select': $ tablename = clean ($ _ POST ['tablename']); SelectedData ($ tablename); break; Case 'blah': blah (); Break; }} Function selected data ($ table) {// connection connection connection $ connection = mysql_connect ("localhost", "root", "") or die ("could not connect to the server."); // Select Database $ db = mysql_select_db ("ideaddcom_maps", $ connection) or die ("database could not be selected."); // SQL $ SQL = 'Select * FROM' $ table; // execute SQL queries and get results $ sql; $ Sql_result = @ mysql_query ($ sql, $ connection) or die ("The query could not be executed". Mysql_error ()); $ Line = mysql_fetch_object ($ sql_result); Forex Currency ($ line $ cname => $ cvalue) {echo "result = $ cvalue"; } // free resources and close connections mysql_free_result ($ sql_result); Mysql_close ($ connection); } // function to sanitize values ​​received from the form, the function clears the SQL injection function ($ str) {$ str = @trim ($ str); If (get_magic_quotes_gpc ()) {$ str = strpsl ($ str); } Return mysql_real_escape_string ($ str); }? & Gt;   

What's wrong? Any thoughts and thanks for this.

I do not know if you have your own

1 - PHP To avoid

Undefined index notice , you should always verify that your class is set before using it , Like what you did on line 7.

3 - Avoid all the outputs not used by AS script in Strong> AP Script because AS < / Strong> will only get the first output.

4 - If you use or foreach loop to get data in your PHP scripts You should do this because echo should be executed once AS :

  $ result = ';; $ Sep = ','; Forex Currency ($ line $ cname = & gt; $ cvalue) {$ Result = $ Cvalue $ September; } Resonance 'result ='. $ Result;    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -