SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Flash and PHP/MySQL

    My girlfriend is running a café and I'm working on a website in Flash for her.
    I'm planning to make a simple, but nice looking website with some of the things she is selling (sandwiches, sallads, soups and so on).

    Sometimes she might add or remove something on her list or maybe change a price or whatever. She is also selling a soup of the week.
    So, I thought I would make a db in MySQL and setup a simple admin page where she can change fields for soup of the week or the list of what she is offering.

    I have never worked with a connection between Flash and MySQL, so I would like a tip on what to think about or what I should do or not do.
    I'm not sure at all, but I guess I need to work with an XML file? Never did that either and not sure if I can make php update something like that?
    Or is there a better solution for the thing I'm working on?

    I really would like it to be simple for her to update without downloading or uploading files. I want it to be simple for her to use, otherwise she would probably not do it. ;-)

  2. #2
    Non-Member
    Join Date
    Apr 2004
    Location
    Miami, FL, USA
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You'll want to create a RESTful API or XML-RPC or SOAP service in PHP that you can call from Flash. How you implement it in Flash will depend based on whether you're using AS2 or AS3. It can be very simple or very complex, based on how you choose to implement it. Probably the simplest way to do it would be with SOAP - Build a SOAP service in PHP using SoapServer or nusoap, and then build a SOAP Client in Flash to access the service.

  3. #3
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Well, I haven't decided whether to use AS2 or AS3. What would be the easiest?
    Would be great if I could make this with only PHP and MySQL. I never used Soap and have no idea of what it is. But not sure if I will be able to learn one more thing here...

    Is there an easy way with either AS2 or AS3?
    And how do I export a php file to XML? Is that easy?

  4. #4
    Non-Member
    Join Date
    Apr 2004
    Location
    Miami, FL, USA
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you use a SOAP Server in PHP and Client in Flash, you won't have to worry about XML or any of the details of the service. You just plug it in to your library on the server side, connect to a url on the client side, and call your PHP functions directly from Flash.

    Go spend a few hours learning and save yourself a few days of programming.

  5. #5
    Community Advisor silver trophy

    Join Date
    Nov 2006
    Location
    UK
    Posts
    2,551
    Mentioned
    40 Post(s)
    Tagged
    1 Thread(s)
    If you're just loading a few variables from the backend then you don't need the extra layer of complexity that converting to/from xml/soap add.

    Just use php to read from the database then output as url encoded name/variable pairs
    e.g souptype=tomato&price=4.00

    Then you can easily load these variables in flash without having to parse xml, and assign to a textfield in dozen lines of code. There's no need for anything more complicated than this.

  6. #6
    Non-Member
    Join Date
    Apr 2004
    Location
    Miami, FL, USA
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by EastCoast View Post
    There's no need for anything more complicated than this.
    Not sure how that's easier OR better. SOAP libraries exist for both AS and PHP, and it can be rolled out with little effort, has complete error-handling and message reporting capabilities built in, will scale with the application, and completely eliminates the need to build ANY communication infrastructure on EITHER end.... it also allows for multi-dimensional data to be returned without the need for custom architecture of how that data is represented.... it's just easier all-around, more stable, and a standard that any developer can use in the future.

  7. #7
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Is it possible to include a box with a php page inside a Flash project? So I can format the output with size and fonts on a php page and then just show the output inside my Flash movie?
    Or maybe that was what EastCoast tried to explain here? I just didn't get it how to do it.

  8. #8
    Non-Member
    Join Date
    Apr 2004
    Location
    Miami, FL, USA
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's not what he's saying. You can output HTML from your php page, and display that HTML formatting in a text-box in Flash.

  9. #9
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    sweden
    Posts
    646
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yes. That would be a simple solution. So I can actually make a textbox in Flash and fill it with the html page that my php code is generating. Then it would be ok. Wouldn't it?

  10. #10
    Non-Member
    Join Date
    Apr 2004
    Location
    Miami, FL, USA
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The Flash HTML-formatted textfield only supports HTML text formatting, anchors, and images.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •