[PHP] Dynamic Var in array [Fast response plz]

09/16/2012 13:00 janvier123#1
[syntax=php]
$tpl = "";
$query2 = $db->SQLquery("SELECT * FROM character.dbo.user_character_achievements WHERE character_no = 'C12090560000000127' ");
$data = $db->SQLfetchArray($query2);

$query3 = $db->SQLquery("SELECT * FROM account.dbo.user_achievements ");
while ($achie = $db->SQLfetchArray($query3))
{
$id = "achid_".$achie['id'];
$done = $data[$id];
$tpl .= "<tr><td><img src='achimg.php?done=".$done."&triggers=".$achie['triggers']."&finished_triggers=".$done."&name=".urlencode($a chie['name'])."&desc=".urlencode($achie['desc'])."&id=".$achie['id']."'></td></tr>";
}

[/syntax]


Ok code may seem crappy but i CANNOT change it


here is what the prob is

I need to have a value from the database $data['achie_xx']
the XX refers to $achie['id'], so my question is how to i get $data['achie_1'], $data['achie_3'],$data['achie_9'] ?


thx
09/16/2012 15:12 Mikesch01#2
it's already in the code...the variable you need is $done. $done contains the string achie_$id, so while is giving you in every loop the resulted id you need.
09/18/2012 08:56 janvier123#3
Thx for that :)