A while loop in PHP
PHP Code
while ($rows =mysql_fetch_array (mysql_query ("Select Pl_title from Pagelinks limit")) { $string = $rows [' Pl_ Title ']; $string 1=urlencode ($string);} echo $string; $url = "http://localhost/index.php/". " $string 1 "; $contents = file_get_contents ($url); if (Preg_match_all ('/(
<><\ table="">
)/ius ', $contents, $ Match)) {$contents = $match [1][0];} else{ (Preg_match_all ('/(
<><\ ol="">
)/ius ', $contents, $match)); $contents = $match [1][0]; Echo $match [1][0]; }
<\>
<\>
This process 2 data, will be more than 30 seconds timeout, is the statement wrong? The goal is to process the data in batches, with if processing a single piece of data, there is no problem.
------Solution--------------------
while ($rows =mysql_fetch_array (mysql_query ("Select Pl_title from Pagelinks limit"))
Think about whether the value of this expression will become false, and each loop will execute mysql_query ("Select Pl_title from Pagelinks limit"), then you will always get the first result, and you'll be in a dead loop.
------Solution--------------------
You should not time out if you separate the mysql_query (). You write like that into a dead loop.
------Solution--------------------
The while ($rows =mysql_fetch_array (mysql_query ("Select Pl_title from Pagelinks limit") is executed for Each loop
I think it's just a separate writing.
$sql = "Select Pl_title from Pagelinks limit";
$rs =mysql_query ($sql);
.....
and while{} should be from beginning to end, while (..) {
$string = $rows [' Pl_title '];
$string 1=urlencode ($string);
Echo $string;
$url = "http://localhost/index.php/". " $string 1 ";
$contents = file_get_contents ($url);
if ((Preg_match_all ('/( ) (/ius ', $contents, $match))) {
$contents = $match [1][0];
}
else{
(Preg_match_all ('/( )/ius ', $contents, $match));
$contents = $match [1][0];
//
}
Otherwise it's not going to come out of the while, it's a dead loop.
------Solution--------------------
Still have to take mysql_query () out
------Solution--------------------
$query = mysql_query ("Select Pl_title from Pagelinks limit 1,3");
while ($rows =mysql_fetch_array ($query)) {
$string []= $rows [' Pl_title '];
$string 1=urlencode ($string);
}
Print_r ($string);
------Solution--------------------
discuss
PHP Code
$query = mysql_query ("Select Pl_title from Pagelinks limit 1,3");
while ($rows =mysql_fetch_array ($query)) {
$string = $rows [' Pl_title '];
$string 1=urlencode ($string);
}
Echo $string;
......
------Solution--------------------
Loop inside the execution of SQL statements is a very inefficient method, suggest a different way!
------Solution--------------------
PHP Code
) (/ius ', $contents, $match))) {$contents = $match [1][0]; } else{Preg_match_all ('/(
)/ius ', $contents, $match); $contents = $match [1][0]; }//The connected code is deleted, you only need to change the connection to the database in the while on the line mysql_query ("Set names ' UTF8 '); What do the following two sentences mean? $sql = ""; mysql_query ($sql); $SQL = "INSERT into pagecontents (old_title,old_text) VALUES (' {$string} ', ' {$contents} ')"; Query, Failure returns error message mysql_query ($SQL) or Die (Mysql_error ());} While loop ends?>