简体   繁体   English

PHP的回声不打印

[英]PHP echo not printing

Am facing a weird issue in my PHP coding...let me describe the purpose of my PHP code 我的PHP编码面临一个奇怪的问题...让我描述一下我的PHP代码的用途

  1. Read Cell Value from excel and upload it in a MySQL table 从excel读取单元格值并将其上传到MySQL表中
  2. Read EACH value from MySQL table and fetch data from an external source 从MySQL表读取EACH值并从外部源获取数据
  3. Store the data in table fetched from external source 将数据存储在从外部源获取的表中
  4. Echo the process is done 回声过程完成
  5. Echo a link to display the result 回显链接以显示结果

The code is perfectly working fine but when the Excel row size is big then Point 1,2,3 is working but 4,5 is not displaying 该代码可以正常工作,但是当Excel行大小较大时,则第1,2,3点可以正常工作,但无法显示4,5

There is no error no warning... 没有错误没有警告...

Am just clueless why this issue is happening 只是不知道为什么这个问题发生了

Am attaching the code snippet below: 我在下面附上代码片段:

<?php

error_reporting (E_ALL ^ E_NOTICE);

error_reporting (E_ALL ^ E_DEPRECATED);

error_reporting(0);

session_start();

require_once("index11.php");

require_once("simple_html_dom.php");

include('ganon.php');

ini_set('max_execution_time', 1200);






$val2 = $_SESSION['$val2'];




if($_SESSION['$val8'] == "mu")
{

if($_SESSION['$val2'] == "fr")

{

//echo "MU for FR";


$conn = mysql_connect("localhost", "root", "****");


if (!$conn) {
    echo "Unable to connect to DB: " . mysql_error();
    exit;
}

if (!mysql_select_db("DB")) {
    echo "Unable to select mydbname: " . mysql_error();
    exit;
}


$sql = "SELECT DISTINCT EANcode from test WHERE timestamp = DATE( NOW( ) ) and EAncode <> ''";



$result = mysql_query($sql);
$a = 0;

while ($row = mysql_fetch_assoc($result)) {

foreach ($row as $b) 

 { 
$ean = $b;

$url = "WWW.URL.COM" .$ean;

$html = file_get_html($url);


$link=$html->find('a[class=webtrekk]');

$link1 = $link[4] -> href;


$link2 = "WWW.URL.COM" .$link1;

$html = file_get_dom($link2);


$i = 0;

foreach($html('tr') as $rowdata) {
        $name = '';
        $test1 = '';

       foreach($rowdata('a[class="test1"]') as $d) {
            $name = $d('img', 0)->alt;

$name2 = mysql_real_escape_string($name);
$arr = explode("-", $name2, 2);
$name1 = $arr[0];


        }      

foreach($rowdata('td[class="test1"]') as $d) {
            foreach($d('span[class="test1"]') as $d2) {
                $test1 = $d2->getPlainText();
            }
        }      

if(!$test1 == "")
{
$i = $i + 1;

$now = new DateTime();

$dt = $now->format('Y-m-d H:i:s');

mysql_select_db("DB", $conn);

$sql = "INSERT INTO `DB`.`tab_fr` (`pos`, `ean`, `prod_url`, `prod_compttr`, `prod_test1`, `timestamp`) VALUES ('$i', '$ean','$link2','$name1','$test1', '$dt')";

mysql_query($sql) or die('Error, insert query failed' . mysql_error());




}
    }


}      

}
flush();
usleep(300000);
$msg = "Query op Test.fr succesvol afgerond"; 
echo $msg ."<br/>" ;

}


if($_SESSION['$val2'] == "fr")
{
$v2 = "Test.fr,";
}
else
{
$v2 = "";
}


if($_SESSION['$val2'] == "fr")
{

echo "<a href=10d2.php>cLICK HERE ".$v2."</a>" ."<br/>";

}
}

?>

This is happening because of the timeout issue encountered in the code can anybody help me how to continue coding after time out. 发生这种情况是因为代码中遇到了超时问题,任何人都可以帮助我如何在超时后继续进行编码。

When a large number of data is being processed then it may cause a situation equivalent to infinite loop. 当处理大量数据时,可能会导致相当于无限循环的情况。 You see data insertion is success in database but it is not finished. 您会看到数据库中的数据插入成功,但是还没有完成。 So you have to find a trick to avoid this infinite looping execution. 因此,您必须找到一个技巧来避免这种无限循环执行。

Hints: break the entire loop into 3 or two. 提示:将整个循环分成3或2个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM