Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-30-2007, 10:57 AM   #1
Join Date: Apr 2007
Posts: 264
Default how do i send information to a mysql database table?


I would like to make it so the user selects from stages 1-6 different options. Each time an option is selected, it sets the variable for that option to the value.

Now when the user has completed that. How do i check that each variable has a valid value, then if so, send those results to my table in mysql. I'm not sure how to make the PHP file or the code within flash...

My table is structured like this:


Also, i would like to make it so that i can read the results of this, and then load the variables accordinly. So for example, if the user puts in the ID of one of the rows in the table above and clicks submit, it then loads all of the values from option1 - option6 of the mysql into the appropriate variables within flash.

Is this possible?

And finally,
This is not essential, but i think it would be a nice feature.

If the exact table row already exists. i.e it has exactly the same values for option1-option6, it will find this tables ID and display that ID to the user. Instead of creating a new row with exactly the same results, which would not be necessary. Would this be too time consuming to search through the DB if the DB grows quite large. i.e. 5000 rows? I don't want this process to take more than a couple of seconds

thanks so much for any help

jarmanje is offline   Reply With Quote
Old 04-30-2007, 11:17 AM   #2
MMP in Ankara
Join Date: Oct 2006
Posts: 237
Send a message via ICQ to opensea Send a message via MSN to opensea

hmm. i've made a similar thing with a asp connection.

ActionScript Code:
var myVars:LoadVars = new LoadVars(); myVars.sendAndLoad("aspFileName", myVars, "POST"); myVars.onData = function(tempSTR:String) {     if (tempSTR != undefined) {         // events here }
opensea is offline   Reply With Quote
Old 04-30-2007, 09:31 PM   #3
Join Date: Apr 2007
Posts: 264

Hi there\
thanks a lot for your reply!
I'm not sure how to use this.. is it using php and mysql?
jarmanje is offline   Reply With Quote
Old 04-30-2007, 09:33 PM   #4
Super Moderator
Cota's Avatar
Join Date: Jul 2001
Location: NYC
Posts: 10,175

You have to, using LoadVars() send the variables to a PHP script. The PHP script will inturn place the values in the database. A good place to start
Color Wars™ | (kul′ər wôrs) n. - Open conflict between factions. www.theColorWars.com

cota - www.chadworkman.com | http://shavedplatypus.com
occupation: designer | flash developer | server-side developer (php, asp, mssql, mysql)
Cota is offline   Reply With Quote
Old 05-01-2007, 11:16 AM   #5
Join Date: Apr 2007
Posts: 264

Ok thanks a lot. how do i tell it to insert the value of the variable from flash? In this php it is telling it the value what to put in, but not the value of a variable??

Also, how would i check that the variables are all correctly filled with values?

$con = mysql_connect("localhost","peter","abc123");
if (!$con)
die('Could not connect: ' . mysql_error());
mysql_select_db("my_db", $con);
mysql_query("INSERT INTO person (FirstName, LastName, Age)
VALUES ('Peter', 'Griffin', '35')");
mysql_query("INSERT INTO person (FirstName, LastName, Age)
VALUES ('Glenn', 'Quagmire', '33')");
jarmanje is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting Variable values INTO MySQL aswhitehead ActionScript 2.0 3 02-27-2007 01:38 AM
Flash & MySQL Database tomyknoker ActionScript 2.0 1 01-16-2007 11:34 AM
Flash Online - and constantly updating a mysql database patrick3675 ActionScript 2.0 4 12-16-2006 03:52 PM
Best way to access mysql database? erveloso Server-Side Scripting 2 03-24-2005 04:48 PM
how do I create a link with information I pull from my database? winningunicorn Simple Stuff (Newbies) 1 05-01-2003 02:36 PM

All times are GMT. The time now is 04:29 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.