Loading database stuff through PHP/Flash

ok, i have a database with two tables. one table holds the following:

table 1 name: lots
columns: lot_id, number, description, status_id
table 2 name: status
columns: status_id, name, description

i have a php script that goes as follows (i’m ignoring the description fields for now):


// database connection variables
$server = "localhost";
$username = "********";
$password = "******";
$database = "***********";

// database connection statement
$connect = mysql_connect($server, $username, $password);
mysql_select_db($database, $connect);

// get values from the database
$query = "SELECT * FROM lots";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);

// loop through database to get the values
for ($i = 0; $i < $num_results; $i++) {
	$row = mysql_fetch_assoc($result);
	$id .= $row['lot_id'] . "
	$lot .= $row['number'] . "
	$lotStatus .= $row['status_id'] . "

// output the variables so that flash can read them
$output = "" ;
$output .= "id=" . $id . "&" ;
$output .= "lot=" . $lot . "&" ;
$output .= "lotStatus=" . $lotStatus ;

// echo the final output lines
echo $output;


now i’m not 100% sure this script is correct, so if anyone sees problems in it, please do let me know. i know that it needs some additions to pull the linking table (status) to display the status_id, but i have no clue how to write that as im not familiar with php, i just took this script from a user on this forum (i apologize for forgetting your name) and edited it.

anyway, i want to be able to pull out all those fields and load them up in flash so i can use them in the scripts over there. i have a grasp on the LoadVars(); a bit but not sure how to pull all this out and if its correct so that i can use it in flash. the fields im most worried about using is the number field in the lots table and the status_id (in both i guess since its a linking table).

any help would be VERY greatly appreciated. thanks in advance.