Am facing a weird issue in my PHP coding...let me describe the purpose of my PHP code
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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.