I want to use array_diff with the result of an mysql query and the result of an $REQUEST here is what I tried:
while($resultarray3 = mysql_fetch_array($result3))
{
$Bestand = $resultarray3['Bestand']
}
$Ergebnis = array_diff($_REQUEST['Menge'], $Bestand);
I got this error by using it: Warning: array_diff(): Argument #2 is not an array in /var/www/html/lager_management/warenkorb.php on line 143
Example for the array $Bestand:
Array ( [0] => 20 [1] => 250 [2] => 90 )
Example for the array $Menge:
Array ([0] => 10 [1] => 45 [3] => 80 )
You are replacing the varible each time in loop.
Try this
$Bestand =array();while($resultarray3 = mysql_fetch_array($result3))
{
$Bestand[] = $resultarray3['Bestand']
}
$Ergebnis = array_diff($_REQUEST['Menge'], $Bestand);
Need to change/Modify
and