2 Replies Latest reply on Mar 26, 2010 9:03 AM by alcaponis

    DateField and phpMyAdmin problem


      Hi, I have a dateField, var date1:Date and column in the phpMyAdmin table which is also date type.

      I dont find anywhere how to do this:


      When i choose in datefield a date it goes to a var date1 and then date1 goes to a phpMyAdmin.

      I need a date format like this : 2010-03-26.


      Maybe someone knows?

        • 1. Re: DateField and phpMyAdmin problem
          Matt Le Fevre Level 4
          <mx:DateField formatString="YYYY-MM-DD"/>


          will setup the datefields label in the correct format for you.




          how are you sending it to your database? PHP & a HTTPService?

          1 person found this helpful
          • 2. Re: DateField and phpMyAdmin problem
            alcaponis Level 1

                    import mx.events.DateChooserEvent;



                    public var newGimimoData:Date;     //(date1)


            <mx:HTTPService id="newUser" url="php\newUser.php" method="POST" result="newUserResult(event)">

                <mx:request xmlns="">






            <newgimimoData>{newGimimoData}</newgimimoData>                       // (date1)





            This line is in the function in which is newUser,send() and I know that it is wrong, but I dont know how to write it in flex:


            private function addNewUser():void{

            newGimimoData = newGimimoDataTxt.selectedItem.getDate();





            and this is all php file:



                $conn = mysql_connect($hostname_conn, $username_conn, $password_conn);




            //mysql_real_escape_string POST'ed data for security purposes

                $newuser = mysql_real_escape_string($_POST["newuser"]);

                $newpassword = mysql_real_escape_string($_POST["newpassword"]);

            $newvardas = mysql_real_escape_string($_POST["newvardas"]);

            $newpavarde = mysql_real_escape_string($_POST["newpavarde"]);

            $newklase = mysql_real_escape_string($_POST["newklase"]);

            $newgimimoData = mysql_real_escape_string($_POST["newgimimoData"]);


            $query = "SELECT * FROM vartotojas WHERE USERNAME = '$newuser'";


            $result = mysql_query($query);


            $logged = mysql_num_rows($result);


            if ($logged == 1)


            $log = false;




            $log = true;



            if ($log == true)


            $sql = "INSERT INTO vartotojas (USERNAME, PASSWORD. VARDAS, PAVARDE, KLASE, GIMIMODATA) VALUES('$newuser','$newpassword','$newvardas','$newpavarde', '$newklase','$newgimimoData')";


            if (!mysql_query($sql, $conn))


            echo "<status>Sukurti nepavyko</status>";




            echo "<status>Naujas vartotojas sukurtas!</status>";





            echo "<status>Šis vartotojo vardas yra užimtas, bandykite kita!</status>";