RES: RES: CURL problems still

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

 



Hi Terion,

I thing the problems is the time limit on your Server.

Try this now:

Test the var before insert into db:
If(!isset($crime)){$crime=''}

After u remove from the db the unwanted lines.

On the end of the file u do this:

$letters=array();
for($i='A';$i<='Z';$i++){$letters[$i]=$i;if($i=='Z'){break;}}
$tL=count($letters);
$letters=array_keys($letters);

if(isset($_GET['L'])){if(trim($_GET['L'])!==''){if($_GET['L']+1>$tL){$next=0
;$final=1;}else{$next=$_GET['L'];}}else{$next=0;}}else{$next=0;}

$nextLetter=$letters[$next];

if(!isset($final)){

	//do the task
	
		
	//on the end of the file u put this:
	
	
for($i=0;$i<$tL;$i++){if($nextLetter==$letters[$i]){if($i+1==$tL){$nextLette
r=0;$file='A';}else{$nextLetter=$i+1;$file=$letters[$i+1];}break;}}
	#header('Location:'.$file.'.php?L='.$nextLetter);
}

U'll need to make A.php, B.php, C.php, D.php, etc... file, with the same
content., did u get it?
 
Zechim


-----Mensagem original-----
De: Miller, Terion [mailto:tmiller@xxxxxxxxxxxxxxxxxxxx] 
Enviada em: terça-feira, 12 de maio de 2009 10:24
Para: Phpster; Miller, Terion
Cc: Jônatas Zechim; PHP-General List
Assunto: Re: RES:  CURL problems still


>
> 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