PHP gevorderde |
|
beste,
Ik wil de volgende array doorlopen, om te kijken of de key niet 0 is.
array:
Array
(
[0] => Array
(
[id] => 12
[parent_id] => 6
[art_id] => 12
[artoptions_id] => 0
[title] => xxxxx
[quantity] => 1x0
[price] => 12xx,-
[language] => nl
[active] => true
[isagroup] => false
[created] => 2008-07-02
[deleted] => false
[subtitle] =>
[body] => xxxxm
[image] => xxxnus.jpg
)
[1] => Array
(
[id] => 12
[parent_id] => 6
[art_id] => 12
[artoptions_id] => 4
[title] => xxus
[quantity] => gxxrd
[price] => 53,-
[language] => nl
[active] => true
[isagroup] => false
[created] => 2008-07-02
[deleted] => false
[subtitle] =>
[body] => Axx cm
[image] => Daxxnus.jpg
)
)
( ( [id] => 12 [parent_id] => 6 [art_id] => 12 [artoptions_id] => 0 [title] => xxxxx [quantity] => 1x0 [price] => 12xx,- [language] => nl [active] => true [isagroup] => false [created] => 2008-07-02 [deleted] => false [subtitle] => [body] => xxxxm [image] => xxxnus.jpg ) ( [id] => 12 [parent_id] => 6 [art_id] => 12 [artoptions_id] => 4 [title] => xxus [quantity] => gxxrd [price] => 53,- [language] => nl [active] => true [isagroup] => false [created] => 2008-07-02 [deleted] => false [subtitle] => [body] => Axx cm [image] => Daxxnus.jpg ) )
ik probeer dat met een foreach:
<?PHP
foreach ($rs as $key => $value) {
foreach ($rs[$i] as $key => $value) {
if($key['artoptions_id'] != '0')
{
echo "test";
}
}
$i++;
}
?>
<?PHP foreach ($rs as $key => $value) { foreach ($rs[$i] as $key => $value) { if($key['artoptions_id'] != '0') { } } $i++; } ?>
Het gaat echter niet goed, ik krijg een of ander cartetisch product.
Maar ik weet niet waarom.
Weet iemand dit wel? wat doe ik verkeerd?
|