Answer the question
In order to leave comments, you need to log in
Why doesn't this while construct work?
while ($i<5) {
$query = "SELECT DISTINCT(`url`) FROM `str` WHERE `parsed` = 0";
$result = mysqli_query($link, $query) or die('Не могу взять из базы url '.mysqli_error($link));
$rows = mysqli_fetch_all($result, MYSQLI_ASSOC);
// if (count($rows) == 0) break;
$i++;
foreach ($rows as $row) {
$url = $row['url'];
// $options[CURLOPT_PROXY] = $proxy_array[ mt_rand(0, count($proxy_array) - 1) ];
$AC->request($url, 'GET', NULL, NULL, NULL);
}
}
Answer the question
In order to leave comments, you need to log in
In general, while is a very simple construction, and if $i = 0, then the content will be executed exactly 5 times (naturally, if there is no stop in the content)
First: print a wardump inside the loop to judge the number of iterations of the loop consciously.
Example:
while ($i<5) {
var_dump($i);
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question