4 Replies Latest reply on Dec 15, 2006 1:21 PM by Nephthys101

    Talking to a database

    Brenton07 Level 1
      I am working on creating my first Flash/PHP/Mysql application, and naturally am running into some hangups. I wanted to check my setup; when I go to my page on my network, and enter in the information and press submit, it does start talking to the server (it says transferring data from "mydomain.com", and eventually it says done in the browser window, but Mysql is still empty... here is my code, if you see a mistake, or maybe suggest where to initiate trace calls to figure out what is not going through.. thanks, first time!!

        • 1. Re: Talking to a database
          Brenton07 Level 1
          anybody know mysql flash? or a tutorial for flash 8 (alot of them I have found are old and deprecated programming)...
          • 2. Re: Talking to a database
            Peter Lorent Level 2
            Paging David Powers...
            Have a look at: http://foundationphp.com/flash/index.php
            and download the free sample chapter.
            • 3. Re: Talking to a database
              The first step in debugging is to try to localize the problem. Right now, you have (at least!) three different possible points of failure: the movie, the script, and the database. Try running the scripts executed by the PHP script manually with some sample data; if those work, you've localized it to either the script or the movie. Try submitting the same information using an html form; if it works, you've localized the issue to the movie. Finally, try making the simplest possible calls in Flash that you can; if those work, start finding differences between the simple code and your movie.

              Sorry I can't be of more exact help; I'll look at this again tonight.
              • 4. Re: Talking to a database
                I noticed in your ActionScript you have

                loadVariablesNum ("Register.php?RegName=&"+Username, 0); //where Username is the texts instance

                Am I right in assuming you are saying 'Username' is the instance name of the textfield where the user writes their username? If so I don't think you'll be able to pull the information you require. You need to specify you want the text content of the textfield. Like this:

                loadVariablesNum ("Register.php?RegName=&"+Username.text, 0);

                If 'Username' is actually a variable which you have set earlier then ignore what I said.

                I have a feeling the way you're using the loadVariablesNum will cause problems because you're calling the page three times separately, rather than sending all the info together. I would have assumed you would want to send it like this:

                loadVariablesNum ("Register.php?RegName="+Username.text+"&RegPass="+Password.text+"&RegEmail="+Email.text, 0);

                Which brings me on to the formatting of the variables you are passing in the URL. I would imagine the way you have written "Register.php?RegName=&" will simply pass RegName as being blank, bearing in mind "=" is for name and value pairs, while "&" is used to join a load of name/value pairs together. See my previous example.

                That may not be a comprehensive list of issues, just what I noticed at a glance. I have made plenty of assumptions so apologies if I'm wrong. Also I don't know PHP, so no idea if there are problems there too.

                Hope some of it helps.

                :: Nephthys