PHP受影响的行= 1将无法正常工作
发布时间:2020-12-13 21:36:12 所属栏目:PHP教程 来源:网络整理
导读:我的剧本: ?phpob_start();header("Cache-Control: no-cache,must-revalidate"); // HTTP/1.1header("Expires: Sat,26 Jul 1997 05:00:00 GMT"); // Date in the pastheader('Content-type: text/html; charset=utf-8');include "tilslut.php";$userid = $_
我的剧本:
<?php ob_start(); header("Cache-Control: no-cache,must-revalidate"); // HTTP/1.1 header("Expires: Sat,26 Jul 1997 05:00:00 GMT"); // Date in the past header('Content-type: text/html; charset=utf-8'); include "tilslut.php"; $userid = $_GET["userid"]; $s = mysql_query("SELECT points,lastpoint FROM member_profile WHERE user_id = '".$userid."'"); $n = mysql_fetch_array($s); $tid = time(); mysql_query("UPDATE member_profile set points = points+1,lastpoint=$tid WHERE lastpoint<=$tid-60 AND user_id = '".$userid."'"); $e = mysql_query("SELECT points FROM member_profile WHERE user_id = '".$userid."'"); $f = mysql_fetch_array($e); if (mysql_affected_rows() == 1) { $s = mysql_query("SELECT points FROM member_profile WHERE user_id = '".$userid."'"); $n = mysql_fetch_array($s); ?> Inserted! <? }else{ echo "Already got"; } ob_flush(); ?> 我有这个给点. 解决方法
在进行另一次选择之前,必须在更新后立即调用mysql_affected_rows. mysql_affected_rows仅适用于在连接上执行的最后一个查询.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |