$query="select soldierid, hp, attack, defence, range, class, damagetype from soldiers where squad=$squad1 and owner=$playerid"; $result=mysql_query($query); if (!$result) { die (mysql_error()); } $num_rows=mysql_num_rows($result); for ($i=0;$i<$num_rows;$i++) { $row=mysql_fetch_array($result); $squad1[$i]['soldierid']=($row['soldierid']); $squad1[$i]['hp']=($row['hp']); $squad1[$i]['attack']=($row['attack']); $squad1[$i]['defence']=($row['defence']); $squad1[$i]['range']=($row['range']); $squad1[$i]['class']=($row['class']); $squad1[$i]['damagetype']=($row['damagetype']); } //now for the other squad, squad2 $query="select soldierid, hp, attack, defence, range, class, damagetype from soldiers where squad=$squad2"; $result=mysql_query($query); if (!$result) { die (mysql_error()); } $num_rows=mysql_num_rows($result); for ($i=0;$i<$num_rows;$i++) { $row=mysql_fetch_array($result); $squad2[$i]['soldierid']=($row['soldierid']); $squad2[$i]['hp']=($row['hp']); $squad2[$i]['attack']=($row['attack']); $squad2[$i]['defence']=($row['defence']); $squad2[$i]['range']=($row['range']); $squad2[$i]['class']=($row['class']); $squad2[$i]['damagetype']=($row['damagetype']); }