below a little code snippet that causes me some headaches.
I had a similar one working fine, until I needed to redo my code on this one
page entirely.
Now my problem is, that the test in the first line is performed and the
variable $top_in_ord is set. Problem is only, that the following while loop
for some reason doesn't give me any output as it was expected.
As the initial check turns out positive, so the $topping is in $order, I
should actually have $field set during the while loop, yet I get just
nothing.
This does have serious implications on my code that follows, as that code
depends on $field being set, which it should.
Anyone able to locate some mishap here?
Expand|Select|Wrap|Line Numbers
- // check if topping is part of the ordered product,
- // if so, determine the fieldname, $field
- if(substr($order,strpos($order,$topping),strlen($topping))==$topping) {
- $top_in_ord = "TRUE";
- // as $top_in_ord is set to true, one of $top1-$top9 contains $topping
- while (list($top1, $top2, $top3, $top4, $top5, $top6, $top7, $top8, $top9) =
- mysql_fetch_array($result)){
- $i=1;
- do {
- if(${"top".$i} == $topping) $field = "top".$i;
- $i++;
- } while ($i<10);
- }
- }
refining and optimizing is second.
I would highly appreciate any ideas.
/Andreas
--
Registeret Linux user #292411