PHP ver gevorderde |
|
Ik krijg de volgende error (wat meer eromheen gepakt):
Citaat: Array ( [1] => 7 [2] => 12 )
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in /home/vhosts/ghetto-racing.110mb.com/public_html/class.game.inc.php on line 62
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in /home/vhosts/ghetto-racing.110mb.com/public_html/class.game.inc.php on line 62
Notice: Undefined offset: 12 in /home/vhosts/ghetto-racing.110mb.com/public_html/class.game.inc.php on line 67
als ik dit stuk script wil uitvoeren:
<?
while($arr = mysql_fetch_array($res))
{
$res2 = mysql_query("SELECT car,motor,vers,schade,points,id FROM members WHERE id=".$arr[0]) OR die(mysql_error());
$this->queries++;
$arr2 = mysql_fetch_assoc($res2);
$points = $arr2['points'] + $arr2['motor'] + $arr2['vers'] + $arr2['car'] - ($arr2['schade']/10);
$users[$arr[0]] = round($points);
}
print_r($users);
$user = array_flip($users);
$winner = $user[max($users)];
echo $winner;
?>
<? { $this->queries++; $points = $arr2['points'] + $arr2['motor'] + $arr2['vers'] + $arr2['car'] - ($arr2['schade']/10); $users[$arr[0]] = round($points); } $winner = $user[max($users)]; ?>
de regel met array_flip is de schuldige achter de errors..
|