473,382 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Code trouble, looping, doesn't read while loop

Hi there,

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
  1. // check if topping is part of the ordered product,
  2. // if so, determine the fieldname, $field
  3. if(substr($order,strpos($order,$topping),strlen($topping))==$topping) {
  4. $top_in_ord = "TRUE";
  5. // as $top_in_ord is set to true, one of $top1-$top9 contains $topping
  6. while (list($top1, $top2, $top3, $top4, $top5, $top6, $top7, $top8, $top9) =
  7. mysql_fetch_array($result)){
  8. $i=1;
  9. do {
  10. if(${"top".$i} == $topping) $field = "top".$i;
  11. $i++;
  12. } while ($i<10);
  13. }
  14. }
  15.  
My code hasn't been refined for now, for now only workability counts,
refining and optimizing is second.

I would highly appreciate any ideas.

/Andreas

--
Registeret Linux user #292411
Jul 16 '05 #1
1 2143
Andreas Paasch wrote:

Figured it out, somehow my sql request got lost in my code .... I better
investigate that one properly.
--
Registeret Linux user #292411
Jul 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
38
by: jrlen balane | last post by:
basically what the code does is transmit data to a hardware and then receive data that the hardware will transmit. import serial import string import time from struct import * ser =...
84
by: Andy Glew | last post by:
I am in search of any rigourous, scientific, academic or industrial studies comparing naming conventions in C++ or similar languages such as Ada: Specifically, are names formed with...
10
by: Nick L | last post by:
I'm working on a function which creates a pointers to an array of unsigned ints based off a number read from a file. I then continue to read file names from the file, convert the name to a char*...
2
by: Raghu Gupta | last post by:
Hi, Actually i am facing some problem using quickbooks and presently i am not so expert in using it. I am using c# code to retrive the data from quickbooks. it doesn't matter which language we...
19
by: Dave | last post by:
I'm building a research application that needs to be a super speed demon. I decided that one way to do this is to use goto loops instead of while() loops when I need them. that way, instead of...
3
by: Jamie Risk | last post by:
I'm attempting to improve some serially executing code (that uses the SerialPort class) bogging Windows down when it runs. To do the 'antibogging' I'm following the example from MSDN...
9
by: TF | last post by:
Hello all, I made a ASP.NET 2.0 site that shows possible "recipes" for paint colors stored in an access dbase. Basically, 1000 colors are stored with specific RGB values in separate columns. A...
67
by: gator | last post by:
I am quite new to XML and posted a request for example code yesterday. Unfortunately, I did not do a very good job in explaining what I was looking for. Here is an example of a small piece of the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.