title: Put foreach data into a varible and add the varible to a database
body: <p>I've been searching and I've tried multiple ways with no luck, What's happening in my code looks for a link. It will then determine what type of link it is and adjust it to suit my needs. Once adjusted I need it to go into an Array with the end goal of adding that Array to my database. print_r($items) will be where ill be adding the array to the Database if you know how do do this also I will not say no to the help :D I am guessing it the same as adding a variable to the database.</p>
  
  <p>Here is my code so far :) </p>
  
  <pre><code>                //Lets look for links
              $urlcomp = array(); 
              $items = array();
              foreach($html-&gt;find('a') as $element){
  
                  if( strpos( $element-&gt;href, "http" ) !== false) {  
  
                      $urlcomp[] = $element-&gt;href; 
  
                      // Look for gov websites
                      if ((strpos($urlcomp, 'gov') !== false) || (strpos($urlcomp, 'police') !== false) || (strpos($urlcomp, 'nhs') !== false) || (strpos($urlcomp, 'org') !== false) || (strpos($urlcomp, 'council') !== false)){
                      } else { 
  
  
                          if (in_array($urlcomp, $websiteurlall)) {
                          }else{ 
  
                              echo "First Batch  -  " . $urlcomp; 
                              $items[] = array($urlcomp); 
                              echo "&lt;/br&gt;";  
  
                          }
  
                      }                       
  
                  }else{ 
  
                      $urlcomp = $websiteurlcomp.$element-&gt;href;   
  
                      // Look for gov websites
                      if ((strpos($urlcomp, 'gov') !== false) || (strpos($urlcomp, 'police') !== false) || (strpos($urlcomp, 'nhs') !== false) || (strpos($urlcomp, 'org') !== false) || (strpos($urlcomp, 'council') !== false)){   
                      } else { 
  
  
                          if (in_array($urlcomp, $websiteurlall)) {
                          }else{
  
                              echo "Second Batch  -  " . $urlcomp;
                              $items[] = array($urlcomp);
                              echo "&lt;/br&gt;";  
  
                          } 
                      } 
                  }  
              } 
  
  
              print_r($items);
  </code></pre>