I have a flash file with the variable "from" and a movieclip called "takensquare". This connects to a database with fields "id", "user", "taken" and "date". The user clicks on a square in the flash file and the square zooms in to reveal a further 10,000 squares. When this loads up I want flash to place movieclips (takensquare) depending on the results from the database.
Is the syntax in the SQL query above correct? ie: if "from" in flash was 210,001 then I want all the records between 210,001 and 220,000 selected where taken is equal to 1. I'm not sure how to output the results for the field "id" back in to flash.PHP Code:<?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());
?>
Finally, in flash, I want the movie clip "takensquare" to be duplicated on the stage for each result. The location for each movie clip would be set according to the following formula:
This is the last hurdle for my project. Thanks to all those who've previously helped out. Much appreciated!Code://work out x position for movieclips movieclipxlocation = queryresult / 100; movieclipxlocation = Math.floor(movieclipxlocation); movieclipxlocation = movieclipxlocation * 100; movieclipxlocation = queryresult - movieclipxlocation; movieclipxlocation = movieclipxlocation - 1; movieclipxlocation = movieclipxlocation * 8; //work out y position for movieclips movieclipylocation = queryresult - from + 1; movieclipylocation = _ymouse / 100; movieclipylocation = Math.floor(movieclipylocation) * 8;![]()




Reply With Quote