本文整理汇总了PHP中cls_mysql::affected_rows方法的典型用法代码示例。如果您正苦于以下问题:PHP cls_mysql::affected_rows方法的具体用法?PHP cls_mysql::affected_rows怎么用?PHP cls_mysql::affected_rows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cls_mysql
的用法示例。
在下文中一共展示了cls_mysql::affected_rows方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: COUNT
}
$uc_db = new cls_mysql(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCHARSET, 0, 1);
$total_members = $uc_db->getOne("SELECT COUNT(*) FROM ". UC_DBTABLEPRE ."members");
$sql = "SELECT uid, username, password, email, salt FROM ". UC_DBTABLEPRE ."members ORDER BY uid ASC LIMIT $limit, $item_num";
$uc_query = $uc_db->query($sql);
while($member = $uc_db->fetch_array($uc_query)){
$user_exists = $db->getOne("SELECT COUNT(*) FROM {$prefix}users WHERE `user_name`='{$member['username']}'");
if (!$user_exists) {
$sql = "INSERT INTO {$prefix}users (`email`, `user_name`, `password`, `salt`) VALUES('{$member['email']}', '{$member['username']}', '{$member['password']}', '2{$member['salt']}')";
++$statistics['insert'];
} else {
$sql = "UPDATE {$prefix}users SET `password`='{$member['password']}', `salt`='2{$member['salt']}' WHERE `user_name`='{$member['username']}'";
++$statistics['update'];
}
$db->query($sql);
if ($db->affected_rows() > 0) {
++$statistics['success'];
} else {
++$statistics['error'];
}
}
if (($limit+$item_num) > $total_members) {
$update += $statistics['update'];
$insert += $statistics['insert'];
$success += $statistics['success'];
$error += $statistics['error'];
$message = "<p>鍏辨湁 <strong>$total_members</strong> 涓?細鍛樻暟鎹?/p><p>瀵煎叆瀹屾垚锛?/p><p><ul><li>鏇存柊鐨勭敤鎴锋暟鎹?細$update 鏉狘/li><li>鏂板?鐨勭敤鎴锋暟鎹?細$insert 鏉狘/li><li>鎴愬姛鐨勭敤鎴锋暟鎹?細$success 鏉狘/li><li>鍑洪敊鐨勭敤鎴锋暟鎹?細$error 鏉狘/li></ul></p><p><a href=\"index.php\"><b>>> 濡傛灉鎮ㄩ渶瑕佹墽琛屽崌绾х▼搴忥紝璇风偣杩欓噷杩涜?鍗囩骇</b></a></p>";
showmessage($message);
} else {
$update += $statistics['update'];
$insert += $statistics['insert'];