本文整理匯總了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'];