Miller, Terion wrote:

Well I tried it and still it stopped at the "C's"

1:
your script is timing out, you need to set the time limit higher
set_time_limit(0);

2:
foreach($html->find('table') as $table) {
$rows = explode('</tr>' , $table );
$headerCells = explode('</th>', array_shift($rows));
$struct = array();
foreach( $headerCells as $c => $cell ) {
  $struct[] = str_replace(' ', '_', trim(strtolower(strip_tags( $cell ))));
}
$data = array();
foreach( $rows as $r => $row ) {
  $cells = explode( '</td>' , $row );
  $item = array();
  foreach( $cells as $c => $cell ) {
    $item[$struct[$c]] = trim(strip_tags( $cell ));
  }
  $data[] = $item;
  $query = "INSERT into `warrants` ";
  $query .= "(name, age, warrant, bond, wnumber, crime)";
  $query .= " VALUES (";
  $query .= " '{$item['name']}',";
  $query .= " '{$item['age']}',";
  $query .= " '{$item['warrant_type']}',";
  $query .= " '{$item['bond']}',";
  $query .= " '{$item['warrant_number']}',";
  $query .= " '{$item['offence_description']}'";
  $query .= " )";
  echo $query . "\n";
  // run query here
}
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to