3 Replies Latest reply on May 23, 2011 1:50 AM by fabien M

    how to create services for sql querry with joint 2 tables ?

    fabien M

      Hi all,

       

      I start to learn the php services function for mysql querry in flex 4.5 and all seam to be ok.

      But i don't find anny help or tutorial to create service that call a sql querry with joint to tables, like this :

       

      Select table01.fieldA table02.fieldA WHERE table01.fieldC LIKE table02.fieldC

       

      Are there a way to do that in flashBuilder creation services interfaces, or not ?

       

      Does we make a special value Object and all the AS3  classes and not use the template opperations ?

       

      Thank's for your help or link

       

      fbm

        • 1. Re: how to create services for sql querry with joint 2 tables ?
          Codeandview

          Hi Fabien,

           

          I'm afraid you'll have to learn a bit more about PHP...

          Joined tables is a relational database feature. It has nothing to do with PHP, and PHP has nothing to do with Flex...

          The "magic" of the flex framework is that it can plug itself into any backend (.Net, Java, PHP...)

           

          The new way Flash Builder interacts with PHP is through AMF (Actionscript Messaging Format) with the help of Zend and Zend_Amf. You've been able to do it on your own for a while, but it was a bit tricky to set up... The new IDE helps you doing those mapping with wizards. What it does is that it serializes and deserializes objects from PHP to Actionscript, and also generates Actionscript value objects.

          So what you'll have to do is to write your own PHP services to retrieve your data from joined tables in MySQL. Those services will return simple arrays. Then start the wizard, select your services. Flash Builder will then map the objects contained in the PHP arrays into Actionscript typed objects.

          I suggest you have a deep look into Zend_Tables...

           

          Hope it'll help.

           

          Julien.

          • 2. Re: how to create services for sql querry with joint 2 tables ?
            fabien M Level 1

            Hi Julien,

             

            Thank's a lot for your answer.

            Yes i know the principe of  Joined table database, SQL syntax and php, and i work with that for many project.

            But i don't know Zend-Amf, as you said, i would like to use the serialize and deserializes function from it in flex.

            Don't konw how to how to make Value Object in this case (from 2 tables), but now, with your help, i understand that i need to build my custom php services and create values object for it and map this.f.

            I belieb that i need to learn  zend-amf.

            • 3. Re: how to create services for sql querry with joint 2 tables ?
              Codeandview Level 1

              Hi Fabien,

               

              For now, just focus on the PHP-side. If you use Flash Builder 4.5 for PHP, it will setup Zend_Amf and de/serialize your value objects on top of the arrays returned by your services calls on its own.

              For that, "plug" those services calls on a datagrid and follow the wizard.

               

              Good luck ;-)

               

              Julien.