SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    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);
    Can anyone see what I'm doing wrong as my eyes are going square looking at it.

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,496
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    while (($subItemCheck < $itemCheck) || ($itemCheck==0 && $subItemCheck>0)) {

  3. #3
    SitePoint Member
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •