5 Replies Latest reply on Jun 24, 2006 8:55 AM by Joaquín Alonso

    Write to mySQL database easily?

    Dan_Orth
      Hi-
      I am currently a student just having some fun with the Flex beta but as a student I do not have access to powerful corporate networks or data services, etc. I have a lot of great ideas for flex applications for clubs I am in, etc. but they all require reading and writing to mySQL databases. So far I have only been able to find 2 tutorials online about mySQL and Flex and I haven't even been able to get the write part of those to work for some reason.

      But my general question is: How easy is it for someone to use Flex (the free versions) to read and write to a mysql database pretty frequently with some things that are a little more than just basics (updating two tables are once for instance)? Is flex better for read only applications for someone in my situation?

      I would really appreciate some advice / insight from you more experienced users so I know where to focus my time and energies.

      Thank you!
      -Dan
        • 1. Re: Write to mySQL database easily?
          cjwprostar.
          I haven't been using Flex for very long, but I have found it very easy to work with Flex and MySQL using PHP. All I had to do was make a php page with multiple functions that accessed the database and executed a query. In flex, I send an HTTPService request to myPhpPage.php?functionName=myUpdateFunction and send out any other data that the function will need. Then the php function prints out xml containing parts of the results that I needed, and Flex does what it needs to do with the xml.

          Hope that helped,
          Chris
          • 2. Re: Write to mySQL database easily?
            Joaquín Alonso
            How difficult or easy to send/obtain data from you data tier depends of the way and how much data at the same time you request or send, I have a couple of examples of Flex 2 + PHP + MySQL and all work great,

            I think that Flex not only can be use for request and present the data, Flex support many ways to send data to a data tier (DB) but again depend of the way you structure the form of send that data.
            • 3. Re: Write to mySQL database easily?
              Dan_Orth Level 1
              Thanks for the replies everyone. Chris, I definetely like your idea of just one php file that handles all of it. Joaquín, would it be possible to perhaps see some of the code for those applications or some of the part to exactly how you handle the integration between flex and the database and what sort of layer you use inbetween? I am interested in just some sample php files to get me going. Thanks!
              -Dan
              • 4. Re: Write to mySQL database easily?
                ntsiii Level 3
                Furthermore, Flex is completely independent or the server tier, and you can use almost any server-side platform you are comfortable with.

                I personally use ASP.NET and communicate with Flex using HTTPService. I have also used classic ASP and JSP to do this. ColdFusion also works well I am told.

                Unless you buy FDS(Flex Data Services), you must choose between RemoteObject, HTTPService or WebService as your transport protocols, but that is a very wide selection of mostly standard options.

                Joaquin, what do you use with PHP?

                Tracy
                • 5. Re: Write to mySQL database easily?
                  Joaquín Alonso Level 1
                  Hi,

                  Until now I use HTTPServices to get/send data to my DB.

                  Dan Orth let me find some code that can help you.