Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/12/2015, 12:50
edgaralcalaserra
 
Fecha de Ingreso: octubre-2015
Ubicación: ciudad juarez
Mensajes: 90
Antigüedad: 8 años, 7 meses
Puntos: 1
Pregunta include o require

buen dia
un problema con un archivo php y javascript

tengo un script de java el cual me suma un numero esto esta bien no tengo problemas, tengo otro archivo que se llama consultas este me da las consultas de mysql y tiene la opción de refrescarse cada cierto tiempo. el problema es que cuando se da el refresh me reinicia la cuenta de los números como puedo hacer para que no me los reinicie.

include.php
Código PHP:
<?php
require 'consulta.php';
include 
'can.php';
?>

<table width="641" border="1">
<tr>
<th  width="50%" style="background-color:#0C77E2; text-align:center; color:#FFF">LINEA1</th>
<th  width="50%" style="background-color:#0C77E2; text-align:center; color:#FFF">Logrado</th>
<th  width="50%" style="background-color:#0C77E2; text-align:center; color:#FFF">Meta</th>
</tr>

<th  width="50%" style="background-color:#F4DA13; text-align:center; color:#4013F4">Embobinado</th>
<?php 
if($numemb>=11){ 
echo 
"<td  align='center' bgcolor=#24C012>$numemb</td>"
}else{ 
    echo 
"<td align='center' bgcolor=#EB1010>$numemb</td>"

?> 
<td  align="center"> <span id="valor"></td>
</tr>
<tr>
<th  width="50%" style="background-color:#F4DA13; text-align:center; color:#4013F4">Oven</th>
<?php 
if($numoven>=18){ 
echo 
"<td  align='center' bgcolor=#24C012>$numoven</td>"
}else{ 
    echo 
"<td align='center' bgcolor=#EB1010>$numoven</td>"

?> 
<td  align="center"><span id="valor"></td>
</tr>
<tr>
<th  width="50%" style="background-color:#F4DA13; text-align:center; color:#4013F4">Corecoil</th>
<?php 
if($numemb>=18){ 
echo 
"<td  align='center' bgcolor=#24C012>$numcore</td>"
}else{ 
    echo 
"<td align='center' bgcolor=#EB1010>$numcore</td>"

?> 
<td  align="center"><div id="recargado3"></div></td>
</tr>
<tr>
<th  width="50%" style="background-color:#F4DA13; text-align:center; color:#4013F4">Final</th>
<?php 
if($numemb>=12){ 
echo 
"<td  align='center' bgcolor=#24C012>$numfinal</td>"
}else{ 
    echo 
"<td align='center' bgcolor=#EB1010>$numfinal</td>"

?> 
<td  align="center"><div id="recargado4"></div></td>
</tr>

</table>
</body>
</html>

consulta.php
Código PHP:
<?php
//hacemos la conexion al servidor MySql
$mysqli = new mysqli("localhost""root""Admi2015""eaton");
if (
$mysqli->connect_errno) {
    
printf("Connect failed: %s\n"$mysqli->connect_error);
    exit();
}
$queryemb=("SELECT *
FROM  embobinado"
);
$resutaemb=$mysqli->query($queryemb) or die(mysqli_error($mysqli));
$numemb mysqli_num_rows($resutaemb);
$queryoven=("SELECT *
FROM  oven"
);
$resutaoven=$mysqli->query($queryoven) or die(mysqli_error($mysqli));
$numoven mysqli_num_rows($resutaoven);
$querycore=("SELECT *
FROM corecoil"
);
$resutacore=$mysqli->query($querycore) or die(mysqli_error($mysqli));
$numcore mysqli_num_rows($resutacore);
$queryfinal=("SELECT *
FROM empaque"
);
$resutafinal=$mysqli->query($queryfinal) or die(mysqli_error($mysqli));
$numfinalmysqli_num_rows($resutafinal);
$self ='include.php'//Obtenemos la página en la que nos encontramos
header("refresh:10; url=$self"); //Refrescamos cada 300 segundos
?>
suma.php

Código PHP:
<head>
    <
meta charsert="utf-8"></meta>
    <
meta name="viewport" content="windth=divice-width,initial-scale=1,maximum-scale=1"></meta>
    <
meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></meta>
    <
script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"</script>
    <script src="https://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <script src="https://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<head>
  <title></title>
 
<script type="text/javascript">
//<![CDATA[
var variable1 = 1;
function sumar() {
  var embobinado1 = variable1++;
  // mostrar el valor de variable1
 document.getElementById('valor').innerHTML = embobinado1;
}

</script>
</head>
<body onload="setInterval('sumar()',1000)">
</body>
</html>