Reputation: 2015
In my project backend, I am importing data from excel sheet(50-100), save them to database, send those data to 5 people via mail and sms. All is working fine. Data is saved through batch_insert() function, mail is also going to right person and sms is also going to all the person. But the problem is though the working is successful after loading for some time the backend gives error as :
The connection has timed out
The server at 'domain name' is taking too long to respond.
The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer's network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
How am I to resolve this issue. Any idea/suggestion will be helpful. Thanks in advance.
Upvotes: 1
Views: 973
Reputation: 21
Here's an example of code to make a progress bar :
function outputProgress($current, $total) {
echo "
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\">
<html>
<head>
<style type=\"text/css\">
#progress-bar {
width: 500px;
background: #cccccc;
position: absolute;
}
#progress-bar-percentage {
background: #3063A5;
padding: 5px 0px;
color: #FFF;
text-align: center;
height: 20px;
}
#progress-bar-percentage span {
display: inline-block;
position: absolute;
width: 100%;
left: 0;
}
</style>
</head>
<body>
<div id=\"progress-bar\" class=\"all-rounded\">
<div id=\"progress-bar-percentage\" class=\"all-rounded\" style=\"width: ".round($current / $total * 100 * 5)."px\"><span>".round($current / $total * 100)." %</span></div>
</div>
</body>
";
myFlush();
sleep(1);
}
/**
* Flush output buffer
*/
function myFlush() {
echo(str_repeat(' ', 256));
if (@ob_get_contents()) {
@ob_end_flush();
}
flush();
}
$current =0
outputProgress($current, count($examples));
foreach ($examples as $example) {
//actions
outputProgress($current, count($examples));
$current++
}
Upvotes: 2