Skip to main content
Participant
March 28, 2009
Question

how do i Send data from flash to php to database

  • March 28, 2009
  • 2 replies
  • 338 views
Hi,
Can anyone give me a simple tutorial on how to send data from a flash to a database and how the receive it aswell. Im presuming you pass the data from the flash to a php file to the database when sending and call the data using a php file to the database aswell. What im trying to do is just have a button that will increment a number in a database by 1 and then display that information on a different Frame within the flash later.

Basically what i want to do if have a button pressed to increment a number in a database.

Hope you can help as i would be very greatful .

Peter
This topic has been closed for replies.

2 replies

Inspiring
March 29, 2009
Yes, you send to PHP, and PHP does the database work. You want to use the
LoadVars class' sendAndLoad method to do it.

If you have a php page on your server, you do something like so in Flash:

var rv = new LoadVars(); //for receiving the result
rv.onLoad = function(success:Boolean){
trace(this["ok"]);
}
var sv = new LoadVars(); //for sending to php

sv.inc = 1;

sv.sendAndLoad("someDomain.com/myphpfile.php", rv);

then in your myphpfile.php you would do like so:

<?php
$inc = $_REQUEST['inc'];

if($inc == '1'){
//do the inc

}

echo "&ok=1"; //send ok back to flash

?>

--
Dave -
www.offroadfire.com
Adobe Community Expert
http://www.adobe.com/communities/experts/


Ned Murphy
Legend
March 28, 2009
Visit http://www.gotoandlearn.com and look for a tutorial there.