title: looping through xpath results
body: <ol>
  <li>I have gone to the db and created an array of url's.</li>
  <li>Then I go through the array and use xpath to tell me how many links there are per url.</li>
  <li>This is where my head hurts.</li>
  </ol>
  
  <p>I have a count for each url of the no of objects in each url. So I'm now trying to collect each of the nodevalues from part 2.</p>
  
  <p>I'm obviously doing something wrong but need some guidence please </p>
  
  <pre><code> $items = array();
  $query = "SELECT * FROM `urls`";
  if( $result = mysqli_query($sql,$query));
  
    {
     // Return the number of rows in result set
    $rowcount=mysqli_num_rows($result);
   while ($row = $result-&gt;fetch_assoc()) {
     $items[] = $row;
  
   }
  
   }
      echo '&lt;pre&gt;';
      print_r($items);
    //  $product = array();
    echo $rowcount;
  
  for ($x=0; $x&lt;$rowcount; $x++){
  
    $scrapeurl[$x] = $items[$x][url];
  
     echo $scrapeurl[$x];
  
     $xpath[$x] = new XPATH($scrapeurl[$x]);
  
  
       $urls[$x] = $xpath[$x]-&gt;query("//div[@class='infodata']/strong/a[contains(@id,'test_title')]/@href");
  $count[$x] = $urls[$x]-&gt;length;
  
  
     $data = array();
   for ($i=0; $i&lt;$count[$x]; $i++){
    $data[$i]['url'] = $urls[$x]-&gt;item($i)-&gt;nodeValue;
      $data[] =  $data[$i]['url'];
  
     }
  
      echo '&lt;pre&gt;'; 
     print_r($data);
  </code></pre>