3 Replies Latest reply on Oct 5, 2007 9:12 PM by eze_diablo

    AS3: store data in mysql

    eze_diablo Level 1
      Hi there, and... yes... i got a little problem with the store data. when i press it the button "submit" save 3 entries , not only one, why, this is my code:
        • 1. Re: AS3: store data in mysql
          SymTsb Level 2
          where is your mysql_query call? That code you provided isn't going to insert anything into a mysql database.
          • 2. Re: AS3: store data in mysql
            eze_diablo Level 1
            ok ok, thanks for the answer, but.. the real problem isn´t store the data in the database, when i test the php script in the browser or insert query from php, all is ok, only insert one entry, but when i shot the script with the submit button from flash, insert 3 entries, maybe the problem is inside flash.

            my actionscript code:
            private function conectar(){
            var req:URLRequest=new URLRequest(" http://localhost/include/Query.php");
            var vars:URLVariables=new URLVariables();

            try{
            vars.v1=reg.nombre1.text;
            vars.v2=reg.nombre2.text;
            vars.v3=reg.aPaterno.text;
            vars.v4=reg.aMaterno.text;
            vars.v5=reg.edad.text;
            vars.v6=reg.calle.text;
            vars.v7=reg.numero.text;
            vars.v8=reg.colonia.text;
            vars.v9=reg.cp.text;
            vars.v10=reg.municipio.text;
            vars.v11=reg.localizacion.selectedItem.label;
            vars.v12=reg.telefono.text;
            vars.v13=reg.mail.text;
            vars.v14=reg.tema.text;
            vars.v15=reg.autor.text;
            vars.v16=reg.genero.selectedItem.label;
            vars.v17=now(); //function that return the current day

            req.data=vars;
            sendToURL(req);


            } catch(e:Error){
            trace("conectar: "+e.message);
            }
            navigateToURL(req);
            }

            -----------------------------------------------------------------------------------------

            my php script code :

            <?php
            error_reporting(E_ALL);
            include_once('dbConnector.php');
            $connector=new dbConnector();

            $v1=$_GET['v1'];
            $v2=$_GET['v2'];
            $v3=$_GET['v3'];
            $v4=$_GET['v4'];
            $v5=$_GET['v5'];
            $v6=$_GET['v6'];
            $v7=$_GET['v7'];
            $v8=$_GET['v8'];
            $v9=$_GET['v9'];
            $v10=$_GET['v10'];
            $v11=$_GET['v11'];
            $v12=$_GET['v12'];
            $v13=$_GET['v13'];
            $v14=$_GET['v14'];
            $v15=$_GET['v15'];
            $v16=$_GET['v16'];
            $v17=$_GET['v17'];


            $insert="insert into registros ( primer_nombre, segundo_nombre, ap, am, edad, calle, numero, colonia, cp, municipio, localizacion, telefono, mail, tema, autor, genero, fecha) values ('$v1','$v2','$v3', '$v4', $v5, '$v6', $v7, '$v8', $v9, '$v10', '$v11', $v12, '$v13', '$v14', '$v15', '$v16', '$v17')";

            $connector->query($insert);

            ?>


            thanks again.
            • 3. AS3: store data in mysql
              eze_diablo Level 1
              mmm... thanks for your time, now, all is ok. [ ; )