SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Control Structures problem
-
Mar 31, 2009, 07:12 #1
- Join Date
- Feb 2009
- Posts
- 9
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Control Structures problem
Hello,
I've been working for ages on a tool that extracts data from a site. There are 15 Items per page but there can be 0 or more SubItem(s) per item. Theres only 2 levels, Items and SubItems.
The following code works perfectly, except for the 15th item where it will not find any SubItems, even with the 2 clauses in the While statement.
Code:for ($itemCounter=1; $itemCounter <= $itemCount; $itemCounter++) { #Check whether there is a subItem for this bookmark $itemCheck = strpos($site,$itemStart); $subItemCheck = strpos($site,$subItemStart); if (!$itemCheck) { $itemCheck=0; } while (($subItemCheck < $itemCheck) || ($itemCheck=0 && $subItemCheck>0)) { //do stuff with subItem(s) $itemCheck = strpos($site,$itemStart); $tagCheck = strpos($site,$tagStart);
-
Mar 31, 2009, 09:12 #2
while (($subItemCheck < $itemCheck) || ($itemCheck==0 && $subItemCheck>0)) {
Guido - Community Team Leader
The Votes Are In: The Winners of the 2013 Community Awards are...
Blog - Free Flash Slideshow Widget
-
Mar 31, 2009, 09:52 #3
- Join Date
- Feb 2009
- Posts
- 9
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I could kiss you Guido, and kick myself. I can't believe I missed that for so long
Bookmarks