Trouble with do..while

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

 



Hi all,

I have that script in php that should print on a page the result of lot of
pages defined in this way:

This is the address: www.mysite.com/mypage.php?idx=1&lines=50

It work in this way: if idx=1 and lines=50 my page will look like:

element1
element2
..
element50

if idx=5 and lines=5 my page will look like:

element5
element6
element7
element8
element9

Changing everytime the idx i have new pages so, thats are my variables:

$idx = "www.mysite.com/mypage.php?idx=";
idx_n=1;
$lines="&lines=50";

I let the variable $lines still to 50 and i'll increase $idx_n of 50 for
show all elements i need.

do {
$link = $idx.$idx_n.$lines;
$idx_n=$idx_n + 50;
$f=fopen($link,"r");
$data = "";

do {
    $stream = fread($f, 8192);
    if (strlen($stream) == 0) {
        break;
    }
    $data .= $stream;
} while (true);
fclose($f);

$data=substr($data,strlen($DontNeed),strlen($data));
$pos=stripos($data, $TillHere);
$data=substr($data,0,$pos);

here I clean the $data variable of things I don't need.

echo $data;

} while ($idx_n < 156700);

My trouble is that this "do..while" never keeps all elements.

Generally $idx_n break with value=1601 or 1301 but never show all elements
and its like the script crash cause everything I can write after isnt'
showed.
I simply tried to write after "while" an echo "Its Done"; but isn't showed.
And in the html file that is generated aren't printed neither the tags
</body></html> for close the file.
Simply it crash.

Do someone have some ideas about it?
I would really apprecciate some words about it cause I'm not able to think
at any solutions..

Just..that maybe is something with server? Isn't able to provide so fastly
all requests?

Best Regards
Salvatore

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