-1

申し訳ありませんが、たとえば誰かがリアルタイムでアラートの例を持っています

エージェントが昼食時に 10 分を過ぎるとアラートが発生し、時間に応じてデータベースに挿入され、テーブルに挿入されます。

とても役に立ちます ありがとう

それを比較して異なるアラートを作成する場合、私が本当にやりたいことは何ですか?しかし、私はそれを行う方法がわかりません..これは機能しません

alert.php:

<?php
$host = "" ;
$user = "" ;
$pw = "" ;
$db = "operator" ;

$fechaactual = Date("Y-m-d H:i:s");

$con = mysql_connect($host,$user,$pw) or die ("problemas al conectar");
$database=mysql_select_db($db,$con) or die ("problemas al conectar la bd");

$re = mysql_query(" SELECT * FROM operator ");
while($m=mysql_fetch_array($re)){
$ahi = (strtotime($m['tiempo']));
$ahi1 = date("Y-m-d", strtotime("+10 minutes", $ahi));
$ingresada = strtotime($ahi1);
$now = strtotime($fechaactual);
$lsk = mysql_query("SELECT * FROM lates WHERE id_op ='".$m['ID']."'");   
if($ingresada > $now){
if(mysql_num_rows($lsk) == 0) {
echo "<script>";
echo "alert('".$m['nombre']."  over pass the  ".$m['status']."');";
echo "</script>";
mysql_query("INSERT INTO lates (id_op,nombre) VALUES     ('".$m['ID']."','".$m['nombre']."')");
}else {
echo "is already inserted";}
}
}
?>

ここにスクリプトがあります:

<div id="alertas">
<?php include("alertas.php"); ?>
</div>
<script>
function conn() {
    $("#alertas").load("alertas.php");
}
setInterval("conn()", 100);
</script>

私のテーブル演算子...

CREATE TABLE `operator` (
`nombre` varchar(30) NOT NULL,
 `status` enum('available','break1','break2','lunch','out') character set swe7 NOT NULL   default 'available',
`tiempo` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`msj` varchar(30) default NULL,
`ID` int(15) unsigned NOT NULL auto_increment,
PRIMARY KEY  (`ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

そして私のテーブルは遅れます:

   CREATE TABLE `lates` (
  `id` int(50) NOT NULL auto_increment,
  `id_op` int(20) NOT NULL,
   PRIMARY KEY  (`id`)
   ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
4

1 に答える 1