nicolus
05-26-2011, 01:55 PM
Hello,
I have this actionscript code from a script I bought :
function getscores()
{
var result_lv = new LoadVars();
result_lv.onLoad = function (success)
{
if (success)
{
i = 1;
for (;;)
{
if (i > 20)
{
return;
}
_root["hname" + i] = result_lv["name" + i];
_root["hscore" + i] = result_lv["score" + i];
++i;
}
}
else
{
//Want to display a error message but don't know how :)
}
}
;
var __reg2 = new LoadVars();
__reg2.action = "get";
__reg2.sendAndLoad(_root.scl, result_lv, "POST");
}
This script make a request on a php page.
On this php page I have this :
<?php
$req = mysql_query('SELECT username, score FROM Gamescores') or die('erreur'.mysql_error());
while($data = mysql_fetch_assoc($req))
{
$name = $data['username'];
$score = $data['score'];
echo 'name='.$name.'&score='.$score.'';
}
?>
If I execute the php, it work's well...but the actionscript code seems to not understand the data returned and displays nothing :(
Thank's for your help
I have this actionscript code from a script I bought :
function getscores()
{
var result_lv = new LoadVars();
result_lv.onLoad = function (success)
{
if (success)
{
i = 1;
for (;;)
{
if (i > 20)
{
return;
}
_root["hname" + i] = result_lv["name" + i];
_root["hscore" + i] = result_lv["score" + i];
++i;
}
}
else
{
//Want to display a error message but don't know how :)
}
}
;
var __reg2 = new LoadVars();
__reg2.action = "get";
__reg2.sendAndLoad(_root.scl, result_lv, "POST");
}
This script make a request on a php page.
On this php page I have this :
<?php
$req = mysql_query('SELECT username, score FROM Gamescores') or die('erreur'.mysql_error());
while($data = mysql_fetch_assoc($req))
{
$name = $data['username'];
$score = $data['score'];
echo 'name='.$name.'&score='.$score.'';
}
?>
If I execute the php, it work's well...but the actionscript code seems to not understand the data returned and displays nothing :(
Thank's for your help