You are here: endless while loop « PHP « IT news, forums, messages
endless while loop

Posted by Gunter Sammet on 01/05/05 23:17

Hi all:
I am having some trouble getting the following code to work:

if (is_array($bundle_attributes)) {

reset($bundle_attributes);

while (list($option, $value) = each($bundle_attributes)) {

reset($value);

while (list($option2, $value2) = each($value)) {

$this->contents[$products_id]['attributes'][$option] = $value;

if (tep_session_is_registered('customer_id')) tep_db_query("insert into " .
TABLE_CUSTOMERS_BASKET_BUNDLE_ATTRIBUTES . " (customers_id, products_id,
sub_product_id, products_options_id, products_options_value_id) values ('" .
(int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . $option .
"', '" . (int)$option2 . "', '" . (int)$value2 . "')");

}

}

}

}

It gives me an endless loop in the second while loop. It seems like it
doesn't move the pointer to the next value in the $option array. When I do a
print in that loop, I am getting the key value pair for the first element in
the $option array. Changing it to a for loop works. Any ideas why this
happens?

TIA

Gunter

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация