Ik heb een stuk code waar ik de volgende foutmelding op krijg, namelijk "Warning: array_sum() expects parameter 1 to be array, null given". Dit gaat over regel 20 in de code hieronder.
Wat is de oplossing om dit te verhelpen?
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| $totalcars=3;
$select = "SELECT DISTINCT autoid FROM coureur WHERE leagueid=".$leagueid."";
$res = mysql_query($select) or die(mysql_error());
while($row = mysql_fetch_assoc($res))
{
$e=0;
while ($e < $count)
{
$j=0;
$selectpunt="SELECT q_punten AS qpunten, r_punten AS rpunten, r_snelstepunt AS snelstepunten, r_bonuspunt AS bonuspunten, r_puntaftrek AS strafpunten FROM uitslagen WHERE autoid=".$row['autoid']." AND raceid=".$raceidpuntenc[$e]."";
$respunt = mysql_query($selectpunt) or die(mysql_error());
while($rowpunt = mysql_fetch_Assoc($respunt))
{
$autoidpunten[$j]=$rowpunt['qpunten']+$rowpunt['rpunten']+$rowpunt['snelstepunten']+$rowpunt['bonuspunten']-$rowpunt['strafpunten'];
//echo "".$row['autoid'] ." Race ".$e." - ".$autoidpunten[$j]." - ".$j."<br>";
$j++;
}
if ($j<= $merkpunten)
{
$totalpunt[$row['autoid']][$e]=array_sum($autoidpunten);
}
else
{
$array = $autoidpunten;
$array_count=count($array);
for($i=1;$i<=$merkpunten;$i++)
{
$max_val[$i]=max_key($array);
$view=$array[$max_val[$i]];
unset($array[$max_val[$i]]);
$totalpunt[$row['autoid']][$e]=$totalpunt[$row['autoid']][$e]+$view;
}
}
$e++;
unset ($autoidpunten);
}
$totalpoints[$row['autoid']]=array_sum($totalpunt[$row['autoid']]);
} |
Wat is de oplossing om dit te verhelpen?