CVO
01-29-2008, 01:53 PM
Hello again.
I'm not sure how to pull variables from a database back into flash. I've looked it up and it seems I need to use an array but I'm not sure on the syntax etc.
First I need to pull in a variable from flash called "from". "from" is an int variable. PHP then pulls all the values from the database where the "id" is between the variable "from" and "from"+9999. ie: if from is 120001 then I want records 120001 to 130000 selected. I then want to filter these records so that I only have the ones where another field called "taken" is equal to 1.
I have gotten this far with the php<?php
//this pulls the variables from the flash movie when the user hits submit.
$from = $_POST ['from'];
...log in details removed...
//select squares from database which have already been taken by other users
$sql = "SELECT * FROM `takensquares` WHERE `id` BETWEEN $from AND ($from + 9999) AND taken = 1";
$result = mysql_query($sql) or die(mysql_error());
?> First; is the sql query above worded correctly? I'm not sure about the ($from + 9999) bit.
Finally, how do I go about getting these values sent back in to flash? Is it just a case of sending $result back in to flash and do I have to put $result = $POST ['result']; in the php file?
As you can tell I'm no PHP coder! Any help much appreciated :)
I'm not sure how to pull variables from a database back into flash. I've looked it up and it seems I need to use an array but I'm not sure on the syntax etc.
First I need to pull in a variable from flash called "from". "from" is an int variable. PHP then pulls all the values from the database where the "id" is between the variable "from" and "from"+9999. ie: if from is 120001 then I want records 120001 to 130000 selected. I then want to filter these records so that I only have the ones where another field called "taken" is equal to 1.
I have gotten this far with the php<?php
//this pulls the variables from the flash movie when the user hits submit.
$from = $_POST ['from'];
...log in details removed...
//select squares from database which have already been taken by other users
$sql = "SELECT * FROM `takensquares` WHERE `id` BETWEEN $from AND ($from + 9999) AND taken = 1";
$result = mysql_query($sql) or die(mysql_error());
?> First; is the sql query above worded correctly? I'm not sure about the ($from + 9999) bit.
Finally, how do I go about getting these values sent back in to flash? Is it just a case of sending $result back in to flash and do I have to put $result = $POST ['result']; in the php file?
As you can tell I'm no PHP coder! Any help much appreciated :)