Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在读取通知后重置计数_Php_Mysql_Sql - Fatal编程技术网

Php 如何在读取通知后重置计数

Php 如何在读取通知后重置计数,php,mysql,sql,Php,Mysql,Sql,我目前正在处理通知。 在数据库中插入任何数据后,将更新此通知。但读取该通知后,计数不会重置为零。 i、 e.它将不断更新通知部分中的现有数据。像0,1,2 我的index.php是: $msql=mysql_query("select * from messages order by emp_id desc"); while($messagecount=mysql_fetch_array($msql)) $id=$messagecount['emp_id`ente

我目前正在处理通知。 在数据库中插入任何数据后,将更新此通知。但读取该通知后,计数不会重置为零。 i、 e.它将不断更新通知部分中的现有数据。像0,1,2

我的index.php是:

$msql=mysql_query("select * from messages order by emp_id desc");
        while($messagecount=mysql_fetch_array($msql))
        $id=$messagecount['emp_id`enter code here`'];
        $msgcontent=$messagecount['message'];
ajax部分是:

if(isSet($_POST['emp_id']))

{

$id=$_POST['emp_id'];

$lead_form=mysql_query("select * from comments where emp_id='$id' order by leadform_id");

while($r=mysql_fetch_array($lead_form))

{

$c_id=$r['leadform_id'];

$comment=$r['leadform_id'];
}
更新代码为:

$listsql=mysql_query("select * from comments where emp_id='$id' order by leadform_id limit $second_count,2 ");
            while($rowsmall=mysql_fetch_array($listsql))
            { 
            $c_id=$rowsmall['leadform_id'];
            $lead_date=$rowsmall['lead_date'];
            ?>

            <div class="lead_date_ui">

            <div class="lead_date_text">
            <div  class="comment_actual_text"><?php echo $lead_date; ?></div>
            </div>

            </div>
$listsql=mysql\u query(“从注释中选择*,其中emp\u id='$id'order by leadform\u id limit$second\u count,2”);
while($rowsall=mysql\u fetch\u数组($listsql))
{ 
$c_id=$rowsall['leadform_id'];
$lead_date=$rowsmal['lead_date'];
?>

我在这里看不到任何更新代码。您的脚本可能也是。您应该切换到或并使用准备好的语句。@TimWolla..好的,我会尝试。这意味着mysql不可能。我需要将数据库更改为MySQLi或PDO。