當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MySql::affectedrows方法代碼示例

本文整理匯總了PHP中MySql::affectedrows方法的典型用法代碼示例。如果您正苦於以下問題:PHP MySql::affectedrows方法的具體用法?PHP MySql::affectedrows怎麽用?PHP MySql::affectedrows使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MySql的用法示例。


在下文中一共展示了MySql::affectedrows方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: MySql

<?php

/**
 * Created by PhpStorm.
 * User: john
 * Date: 2015/9/22
 * Time: 15:05
 */
include_once "utils/Tables.php";
include_once "utils/MySql.php";
define("SET_READ", "UPDATE " . TABLE_HISTORY . " SET `isRead` = '1' WHERE `id`=");
if (is_array($_GET) && count($_GET) > 0) {
    if (isset($_GET["id"])) {
        $id = $_GET["id"];
    }
}
$mysql = new MySql();
if (isset($id) && $id > 0) {
    $mysql->query(SET_READ . $id);
    echo $mysql->affectedrows();
} else {
    echo "參數錯誤";
}
開發者ID:sollian,項目名稱:logo_doctor,代碼行數:23,代碼來源:setHistoryRead.php

示例2: MySql

include_once "utils/MySql.php";
define("REGISTER", "INSERT INTO " . TABLE_USER . " (`name`, `password`) VALUE ");
define("QUERY_ALL", "SELECT `id` FROM " . TABLE_USER . " WHERE name=");
if (is_array($_GET) && count($_GET) > 0) {
    if (isset($_GET["name"])) {
        $name = $_GET["name"];
    }
    if (isset($_GET["password"])) {
        $password = $_GET["password"];
    }
}
if (!isset($name)) {
    echo "用戶名不能為空";
    return;
}
if (!isset($password)) {
    echo "密碼不能為空";
    return;
}
$mysql = new MySql();
$sql = QUERY_ALL . "'" . $name . "'";
$mysql->query($sql);
$result = $mysql->affectedrows();
if ($result >= 1) {
    echo "該用戶名已被注冊";
    return;
}
$sql = REGISTER . "('" . $name . "', '" . $password . "')";
$mysql->query($sql);
$result = $mysql->affectedrows();
echo $result;
開發者ID:sollian,項目名稱:logo_doctor,代碼行數:31,代碼來源:register.php

示例3: mkdir

    mkdir($target_path);
    //如果不存在目錄,則建立
}
$img_path = $img_path . $_FILES['file']['name'];
$target_path = ".." . $img_path;
$target_path = iconv("UTF-8", "gb2312", $target_path);
if (!move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
    echo $target_path;
    echo "服務器保存文件失敗";
} else {
    chmod($target_path, 511);
    $mysql = new MySql();
    if (isset($name)) {
        $sql = "SELECT `id` FROM " . TABLE_LOGO . " WHERE `name`='{$name}'";
        $result = $mysql->query($sql);
        if ($mysql->affectedrows() > 0) {
            $value = $mysql->fetcharray($result);
            $id = $value["id"];
        }
    }
    if (isset($id)) {
        /**
         * 獲取
         */
        $sql = "SELECT `moreImg` FROM " . TABLE_LOGO . " WHERE `id`=" . $id;
        $result = $mysql->query($sql);
        $value = $mysql->fetcharray($result);
        $moreImg = $value["moreImg"];
        if ($moreImg) {
            $moreImg = $moreImg . "," . $img_path;
        } else {
開發者ID:sollian,項目名稱:logo_doctor,代碼行數:31,代碼來源:uploadLogo.php

示例4: MySql

define("QUERY_USER", "SELECT * FROM " . TABLE_USER . " WHERE name=");
if (is_array($_GET) && count($_GET) > 0) {
    if (isset($_GET["name"])) {
        $name = $_GET["name"];
    }
    if (isset($_GET["password"])) {
        $password = $_GET["password"];
    }
}
if (!isset($name)) {
    echo "用戶名不能為空";
    return;
}
if (!isset($password)) {
    echo "密碼不能為空";
    return;
}
$mysql = new MySql();
$sql = QUERY_USER . "'" . $name . "'";
$result = $mysql->query($sql);
$value = $mysql->fetcharray($result);
$user = User::getUser($value);
if ($mysql->affectedrows() <= 0) {
    echo "該用戶名不存在";
    return;
}
if ($user->password != $password) {
    echo "密碼錯誤";
    return;
}
echo "";
開發者ID:sollian,項目名稱:logo_doctor,代碼行數:31,代碼來源:login.php

示例5: fgets

         if ($file) {
             $logoName = fgets($file);
             if ($logoName) {
                 $logoName = trim(substr($logoName, 2));
                 //根據logoName獲取logoId
                 $sql = "select * from " . TABLE_LOGO . " where `img`='{$logoName}' OR `moreImg` LIKE '{$logoName}'";
                 $result = $mysql->query($sql);
                 $value = $mysql->fetcharray($result);
                 $logo = Logo::getLogo($value);
             } else {
                 $logo = new Logo(-1, null, null, null, null, null);
             }
             if ($logo) {
                 $sql = "UPDATE `" . TABLE_HISTORY . "` SET `logoId`={$logo->id},`isProcessing`=0 WHERE `id`={$history->id}";
                 $mysql->query($sql);
                 $affetctRows = $mysql->affectedrows();
                 if ($affetctRows > 0) {
                     $history->logoId = $logo->id;
                     $history->processing = 0;
                 }
             }
         }
         fclose($file);
         /**
          * 刪除文件
          */
         chmod($filePath, 511);
         //                    unlink($filePath);
     }
 }
 if ($history->logoId) {
開發者ID:sollian,項目名稱:logo_doctor,代碼行數:31,代碼來源:queryHistoryState.php


注:本文中的MySql::affectedrows方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。