Re: RES: CURL problems still

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
> Bastien, could you give me an example of what you mean?
> would it be $Name = ""
>
> like that?
>
> Thanks for the ideas everyone!
>

>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> Try Imitliazing the variables at the top of the loop to empty strings
> or zeros
>
> Bastien
>
>

Yep, that's it

$_thing = '';


Bastien


Well I tried it and still it stopped at the "C's" maybe I put them in the wrong spot?  I tried something yesterday where I commented out the "C's" url, and it ran through the "F's" could a setting somewhere be restricting how many files it can run...I am just stumped, the script runs fine, inserts the data I'm wanting etc, just can't get it to run all 26 pages....argh.

Code------------------
foreach($html->find('table') as $table) {    foreach($table->find('tr') as $tr)    {              //set variables to nada ? $name = ''; $age = ''; $warrant = ''; $bond = ''; $wnumber = ''; $crime = '';                            // Grab children       $cells = $tr->children();                      if($cells[0]->plaintext != "Name")        {                    for ($i = 0; $i < count($cells); $i++)            {                                  switch ($i){                 case 0: // Name                     $name = $cells[$i]->plaintext;                     echo $cells[$i]->plaintext;                     break;                 case 1: // Age                     $age = $cells[$i]->plaintext;                     break;                 case 2: // Warrant type                     $warrant = $cells[$i]->plaintext;                     break;                 case 3: // Bond amount                     $bond = $cells[$i]->plaintext;                     break;                 case 4: // Warrant number                     $wnumber = $cells[$i]->plaintext;                     break;                  case 5: // Offence description                     $crime = $cells[$i]->plaintext;                     break;                 Default:                     echo "Uh-oh<br />";                 }                                                               }                                   }                    // Build your INSERT statement here              $query = "INSERT into `warrants` (name, age, warrant, bond, wnumber, crime) VALUES (";    $query .= " '$name', '$age', '$warrant', '$bond', '$wnumber', '$crime' )";        $wid = mysql_insert_id();                echo $query;                // run query     mysql_query($query) or die (mysql_error());

---------end code-------------------------------

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux