2 Replies Latest reply on Oct 12, 2009 1:32 PM by gregarroyo

    Writing to a SQL Database

    gregarroyo

      I would really like to see a tutorial on how to write to a SQL data base using Flex, PHP, and MySQL.


      Something similar to the tutorial "Creating PHP services for client applications", but for writting to instead of reading from.


      http://help.adobe.com/en_US/Flex/4.0/html/WS4bebcd66a74275c3-177557f11232f6db7fc-8000.html #WS4bebcd66a74275c3-177557f11232f6db7fc-7fff

       

      So for example, it would be nice to make one of the columns editable, and a submit button for updating the database with your changes.

       

      Also, I know the above tutorial is not part of "Flex In A Week", but you may be interested to know that it has a few mistakes.  I tried to submit these mistakes already but was not sure if I submitted them to the correct place.


      1) Under the section titled “Test the PHP service”, the script in step 1 references PHP_Services.php when it should be referencing EmployeeService.php.  Also, although this is not necessary getemployees() should be camel case to match the function call in the class.  Below is the correct script:

       

      <pre>
      <?php
          include('EmployeeService.php');
          $o = new EmployeeService();
          var_dump($o->getEmployees());
      ?>
      </pre>


      2) Under the section titled "Create a PHP class that implements a service", step 3 is to save the EmployeeService.php in the following location:

       

      <Web Root>/PHP_Service/services/EmployeeService.php

       

      Further down the page in the section titled "Import the service into Flex and bind returned data to application components", the end of step 4 says:

       

      "Use the location that already contains EmployeeService.php. Here is the location previously specified: <Web Root>/PHP_Service/"

       

      This is not the path "previously specified".  The correct path previously specified would be:

       

      <Web Root>/PHP_Service/services/

       

      Also, the only path that worked for me was <Web Root>/PHP_Service-debug/ which was created by FlashBuilder.  Not sure if this is correct or if I should have done a previous step differently.

       

      3) Further down in this same section, in step 10 it says:

       

      "Click Browse and navigate to the PHPservice.php file you created previously"

       

      The correct file name is EmployeeService.php, not PHPservice.php.

       

      4) In step 11 instead of "getBooks()", it should  say:

       

      "getEmployees() is the only operation available in the service."

       

      5) Step 11 should also include all the steps required if this is the first time doing this and Zend is not installed.  This is  likely case for people using this tutorial.

       

      Despite the mistakes, this was still a usefull tutorial once I figured all of this out.

       

      Thanks,

      Greg-