我试图循环访问我的数据库,并在满足某些过滤条件(包括检查标头数据以查看url是否存在)之后向数组中添加数据。PHP while while循环gettng卡住
我看到,循环执行第一轮,因为我看到回声结果,如果我打破循环与退出。但如果我不这样做,它不会回应任何事情,并会无限无尽地做任何事情!
代码:
$gp=0;
include('connnew.php');
$getpages=$clientdb->query("SELECT * FROM clientdata ORDER BY Date DESC") or die("Pages Error : ".$clientdb->error);
while($subdinf=$getpages->fetch_assoc()){
$gp++;
echo "<div style='position:absolute;top:150px;right:60px;'>$gp</div>";
$subdinf['propheading']=$subdinf['propheading']."-".$subdinf['Id'];
$proph=$subdinf['propheading'];
$page=trim(str_replace($splchrs,'-',$proph));
$page=trim(str_replace("&","and",$page));
$page=trim(str_replace(array("---","--"),'-',$page));
if(substr($page,0,32)!="Want-to-Buy-any-kind-of-property" && substr($page,0,40)!="For-sale-1-BHK-2BHK-and-other-properties" && substr($page,0,38)!="Wanted-Apartments-and-other-properties"){
$html5="http://www.landshoppe.com/$page";
$file_headers = get_headers($html5);
if($file_headers[0] == 'HTTP/1.1 404 Not Found') {
$exists = false;
echo "<h3>URL ".$html5." Does not exist !</h3>";
}
else {
$exists = true;
if(!in_array($html5,$link)){
$link[]=$html5;
echo $html5."<br>";
}
}
}
//echo $gp;exit;
}
echo "Total Pages : $gp<br><br>";exit;
有人可以帮助我了解,而我对一些输出无限期地等待发生了什么?
使用'@'进行错误抑制会隐藏任何有用的消息。先删除那个,然后回来看看你看到的任何错误消息。 – vascowhite
“做一个无意的监督优点快速投票”,是的,因为它与诊断问题非常相关,这也是非常糟糕的做法,我每次看到它都会失望。 – vascowhite