I'm trying to integrate php and swishmax. Here is what I have:
The PHP code queries the mysql db for an average score. The code is:
<?php
// Connects to your Database
mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
// Get Average Score
$query = "SELECT AVG(score) FROM data";
$result = mysql_query($query) or die(mysql_error());
// Print out result
WHILE($row = mysql_fetch_array($result)){
echo $row ['AVG(score)'];
}
?>
The code to pull the average score into swishmax is:
<?
//Average score pulled into swishmax
echo "&myVar2=$PHPvariable&";
?>
Where myVar21 is the variable pulled into the swishmax movie and $PHPvariable would be the average score generated by the script above.
My question is how do I get
the average score produced here =>
WHILE($row = mysql_fetch_array($result)){
echo $row ['AVG(score)'];
to be the phpvariable here=>
echo "&myVar2=$PHPvariable&";
so that in essence (not correctly coded)
echo &myVar21=['AVG)score)'];
Thank you in advance to all that respond.