0
Maybe this doubt is quite "beast", but I’ve tried several ways and I’m not succeeding. I have a page that counts a quantity of products, but I need the data presented through the query that is on the page, be updated every 1 second without the page is updated. I tried some solutions in Ajax and JS, but I could not. :(
Does anyone have any tips on how to do this? Below is the php code I’m using:
$con = mysql_connect('localhost', 'root', 'password');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$user = mysql_real_escape_string($user);
$pwd = mysql_real_escape_string($pwd);
mysql_select_db("fabrica", $con);
$sql="SELECT COUNT(codigo) FROM inclusao_codigo WHERE cod_linha = '1' AND cod_turno = '1' AND data = CURRENT_DATE AND erro_ean IS NULL'";
$total = mysql_query($sql);
<link rel="stylesheet" type="text/css" href="../css/rhino/sc_inettuts.css" />
<link rel="stylesheet" type="text/css" href="../css/rhino/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="../css/rhino/gridstack.min.css" />
<link rel="stylesheet" type="text/css" href="../css/rhino/Sc9_Rhino_grid.css" />
<link rel="stylesheet" type="text/css" href="../css/rhino/Sc9_Rhino_gridLTR.css" />
<link rel="stylesheet" type="text/css" href="../css/rhino/Sc9_Rhino_container.css" />
<link rel="stylesheet" type="text/css" href="../css/rhino/Sc9_Rhino_containerLTR.css" />
<div style="display: inline-block">
<div class="widget-content widget-content-title-none scContainerIndexMoldura scContainerIndexMoldura_widget15" style="height: 100%" id="id-div-iframe-4">
<div style="text-align: center; padding-top: 15px">
<div class="clearfix"><span style="font-size:20px; font-weight: bold;"><img src="../_lib/img/sys__NM__img__NM__certificate_full.png"><br>Total de Produtos</span></div>
<div class="clearfix"><span style="float: right; font-size:15px;">Linha 1</span></div>
<div class="clearfix"><span style="font-size:70px;"><?php echo $total; ?></span></div>
</div>