本文整理汇总了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 "参数错误";
}
示例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;
示例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 {
示例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 "";
示例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) {