本文整理汇总了PHP中mysqli_affected_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_affected_rows函数的具体用法?PHP mysqli_affected_rows怎么用?PHP mysqli_affected_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysqli_affected_rows函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: Copyright
/**
|--------------------------------------------------------------------------|
| https://github.com/Bigjoos/ |
|--------------------------------------------------------------------------|
| Licence Info: GPL |
|--------------------------------------------------------------------------|
| Copyright (C) 2010 U-232 V5 |
|--------------------------------------------------------------------------|
| A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. |
|--------------------------------------------------------------------------|
| Project Leaders: Mindless, Autotron, whocares, Swizzles. |
|--------------------------------------------------------------------------|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(1200);
ignore_user_abort(1);
//== Delete inactive user accounts
$secs = 350 * 86400;
$dt = TIME_NOW - $secs;
$maxclass = UC_STAFF;
sql_query("SELECT FROM users WHERE parked='no' AND status='confirmed' AND class < {$maxclass} AND last_access < {$dt}");
//== Delete parked user accounts
$secs = 675 * 86400;
// change the time to fit your needs
$dt = TIME_NOW - $secs;
$maxclass = UC_STAFF;
sql_query("SELECT FROM users WHERE parked='yes' AND status='confirmed' AND class < {$maxclass} AND last_access < {$dt}");
if ($queries > 0) {
write_log("Inactive Clean -------------------- Inactive Clean Complete using {$queries} queries--------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
开发者ID:Bigjoos,项目名称:U-232-V5,代码行数:43,代码来源:inactive_update.php
示例2: processQuery
public function processQuery($sql, $type = NULL)
{
$result = mysqli_query($this->db, $sql);
$this->checkForError();
$data = array();
if ($result instanceof mysqli_result) {
$resultType = MYSQLI_NUM;
if ($type == 'assoc') {
$resultType = MYSQLI_ASSOC;
}
while ($row = mysqli_fetch_array($result, $resultType)) {
if (mysqli_affected_rows($this->db) > 1) {
array_push($data, $row);
} else {
$data = $row;
}
}
mysqli_free_result($result);
} else {
if ($result) {
$data = mysqli_insert_id($this->db);
}
}
return $data;
}
开发者ID:veggiematts,项目名称:usage,代码行数:25,代码来源:DBService.php
示例3: mysql_compat_affected_rows
function mysql_compat_affected_rows($link = NULL)
{
if (!isset($link)) {
$link = $GLOBALS['mysql_compat_last_link'];
}
return mysqli_affected_rows($link);
}
开发者ID:bAndie91,项目名称:mysql-compat-php,代码行数:7,代码来源:mysql_compat.php
示例4: affectedRow
public function affectedRow()
{
if ($this->con) {
return mysqli_affected_rows($this->con);
}
return 0;
}
开发者ID:pvtamh2bg,项目名称:mn2015,代码行数:7,代码来源:Database.php
示例5: affectedRows
/**
* Return the number of rows affected by a query.
*
* @return integer
*/
public static function affectedRows()
{
if (is_null(self::$conn_id)) {
self::init();
}
return mysqli_affected_rows(self::$conn_id);
}
开发者ID:biow0lf,项目名称:evedev-kb,代码行数:12,代码来源:class.dbconnection.php
示例6: docleanup
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(1200);
ignore_user_abort(1);
sql_query("UPDATE `freeslots` SET `addedup` = 0 WHERE `addedup` != 0 AND `addedup` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `freeslots` SET `addedfree` = 0 WHERE `addedfree` != 0 AND `addedfree` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("DELETE FROM `freeslots` WHERE `addedup` = 0 AND `addedfree` = 0") or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `free_switch` = 0 WHERE `free_switch` > 1 AND `free_switch` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `torrents` SET `free` = 0 WHERE `free` > 1 AND `free` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `downloadpos` = 1 WHERE `downloadpos` > 1 AND `downloadpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `uploadpos` = 1 WHERE `uploadpos` > 1 AND `uploadpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `chatpost` = 1 WHERE `chatpost` > 1 AND `chatpost` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `avatarpos` = 1 WHERE `avatarpos` > 1 AND `avatarpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `immunity` = 0 WHERE `immunity` > 1 AND `immunity` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `warned` = 0 WHERE `warned` > 1 AND `warned` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `pirate` = 0 WHERE `pirate` > 1 AND `pirate` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
sql_query("UPDATE `users` SET `king` = 0 WHERE `king` > 1 AND `king` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
if ($queries > 0) {
write_log("User Clean -------------------- User Clean Complete using {$queries} queries--------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
开发者ID:CharlieHD,项目名称:U-232-V3,代码行数:28,代码来源:user_update.php
示例7: insertItems
public function insertItems(Items $items)
{
$con = self::openConnection();
$affected = 0;
mysqli_begin_transaction($con);
$stm = mysqli_stmt_init($con);
$sql = "INSERT INTO category VALUES (?, ?, ?)";
mysqli_stmt_prepare($stm, $sql);
foreach ($items->getItems() as $item) {
$code = $item->getCode();
$name = $item->getName();
$parent = $item->getParent() == null ? null : $item->getParent()->getCode();
mysqli_stmt_bind_param($stm, 'sss', $code, $name, $parent);
mysqli_stmt_execute($stm);
if (mysqli_affected_rows($con) == 1) {
$affected++;
}
}
if ($affected > 0) {
mysqli_commit($con);
} else {
mysqli_rollback($con);
}
return $affected;
}
开发者ID:Voww,项目名称:PHP_test_tasks,代码行数:25,代码来源:CategoryDAO.php
示例8: insertDepartment
function insertDepartment($name, $manager_id)
{
checkConnectivity2();
$query = sprintf("insert into department(name,manager_id\t) values('%s',%s)", $name, $manager_id);
mysqli_query($GLOBALS['connection_link'], $query);
return mysqli_affected_rows($GLOBALS['connection_link']) > 0;
}
开发者ID:mohamed-moanis,项目名称:qa,代码行数:7,代码来源:insetQuires.php
示例9: docleanup
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(0);
ignore_user_abort(1);
//== Delete old backup's
$days = 3;
$res = sql_query("SELECT id, name FROM dbbackup WHERE added < " . sqlesc(TIME_NOW - $days * 86400)) or sqlerr(__FILE__, __LINE__);
if (mysqli_num_rows($res) > 0) {
$ids = array();
while ($arr = mysqli_fetch_assoc($res)) {
$ids[] = (int) $arr['id'];
$filename = $INSTALLER09['backup_dir'] . '/' . $arr['name'];
if (is_file($filename)) {
unlink($filename);
}
}
sql_query('DELETE FROM dbbackup WHERE id IN (' . implode(', ', $ids) . ')') or sqlerr(__FILE__, __LINE__);
}
//== end
if ($queries > 0) {
write_log("Backup Clean -------------------- Backup Clean Complete using {$queries} queries--------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
开发者ID:UniversalAdministrator,项目名称:U-232-V4,代码行数:30,代码来源:backup_update.php
示例10: executeQuery
/**
* Native function for executing mysql query
*/
private function executeQuery($q)
{
if (empty($q)) {
throw new DBException('Empty query submitted!');
}
if (DB_DEBUG) {
$start = microtime(true);
}
$this->_res_resource = mysqli_query($this->_con, $q);
if (DB_DEBUG) {
$end = microtime(true);
$this->_executedQueries[] = array('q' => $q, 'time' => $end - $start);
}
if (!$this->_res_resource) {
throw new DBException(mysqli_error($this->_con));
}
if (preg_match('/^SELECT.+/', strtoupper($q))) {
$this->_res_num = @mysqli_num_rows($this->_res_resource);
} elseif (preg_match('/^INSERT.+/', strtoupper($q))) {
$this->_last_inserted_id = mysqli_insert_id($this->_con);
$this->_affected_rows = @mysqli_affected_rows($this->_con);
} else {
$this->_affected_rows = @mysqli_affected_rows($this->_con);
}
return true;
}
开发者ID:arschlochnop,项目名称:masscan-web-ui,代码行数:29,代码来源:class.mysql.php
示例11: ejecutar
public function ejecutar($sql, $conexion)
{
$n = 0;
$resultado = mysqli_query($conexion, $sql);
$n = mysqli_affected_rows($conexion);
return $n;
}
开发者ID:einarenrique,项目名称:Reto-Masa-Corporal,代码行数:7,代码来源:fung33ker.php
示例12: insertItems
public function insertItems(Items $items)
{
$con = self::openConnection();
$affected = 0;
mysqli_begin_transaction($con);
$stm = mysqli_stmt_init($con);
$sql = "INSERT INTO product VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
mysqli_stmt_prepare($stm, $sql);
foreach ($items->getItems() as $item) {
$code = $item->getCode();
$articul = $item->getArticul();
$name = $item->getName();
$bmuID = $item->getBasicMeasurementUnit() == null ? null : $item->getBasicMeasurementUnit()->getId();
$price = $item->getPrice();
$curID = $item->getCurrency() == null ? null : $item->getCurrency()->getId();
$muID = $item->getMeasurementUnit() == null ? null : $item->getMeasurementUnit()->getId();
$parent = $item->getParent() == null ? null : $item->getParent()->getCode();
mysqli_stmt_bind_param($stm, 'sssdddds', $code, $articul, $name, $bmuID, $price, $curID, $muID, $parent);
mysqli_stmt_execute($stm);
if (mysqli_affected_rows($con) == 1) {
$affected++;
}
}
if ($affected > 0) {
mysqli_commit($con);
} else {
mysqli_rollback($con);
}
return $affected;
}
开发者ID:Voww,项目名称:PHP_test_tasks,代码行数:30,代码来源:ProductDAO.php
示例13: query
public function query($sql)
{
$pos = stripos($sql, 'select');
if (is_numeric($pos)) {
//是select 语句
$rs = mysqli_query($this->conn, $sql);
if (mysqli_errno($this->conn)) {
die('you have an error ' . mysqli_error($this->conn));
}
if ($rs === false) {
return mysqli_affected_rows($this->conn);
}
//什么时候返回是false呢...哦子查询是select
$columns = array();
while ($property = @mysqli_fetch_field($rs)) {
$columns[] = $property->name;
}
$arr = array();
while ($result = @mysqli_fetch_row($rs)) {
$arr[] = array_combine($columns, $result);
}
return $arr;
} else {
mysqli_query($this->conn, $sql);
if (mysqli_errno($this->conn)) {
die('you have an error ' . mysqli_error($this->conn));
}
return mysqli_affected_rows($this->conn);
}
}
开发者ID:Qbuer,项目名称:pt-wechat,代码行数:30,代码来源:conn.class.php
示例14: Copyright
/**
|--------------------------------------------------------------------------|
| https://github.com/Bigjoos/ |
|--------------------------------------------------------------------------|
| Licence Info: GPL |
|--------------------------------------------------------------------------|
| Copyright (C) 2010 U-232 V4 |
|--------------------------------------------------------------------------|
| A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. |
|--------------------------------------------------------------------------|
| Project Leaders: Mindless,putyn. |
|--------------------------------------------------------------------------|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(0);
ignore_user_abort(1);
$deadtime = TIME_NOW - $INSTALLER09['signup_timeout'];
$res = sql_query("SELECT id, username, added, downloaded, uploaded, last_access, class, donor, warned, enabled, status FROM users WHERE status = 'pending' AND added < {$deadtime} AND last_login < {$deadtime} AND last_access < {$deadtime} ORDER BY username DESC");
if (mysqli_num_rows($res) != 0) {
while ($arr = mysqli_fetch_assoc($res)) {
$userid = $arr['id'];
$res_del = sql_query("DELETE FROM users WHERE id=" . sqlesc($userid)) or sqlerr(__FILE__, __LINE__);
$mc1->delete_value('MyUser_' . $userid);
$mc1->delete_value('user' . $userid);
write_log("User: {$arr['username']} Was deleted by Expired Signup clean");
}
}
if ($queries > 0) {
write_log("Expired Signup clean-------------------- Expired Signup cleanup Complete using {$queries} queries --------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
开发者ID:UniversalAdministrator,项目名称:U-232-V4,代码行数:43,代码来源:expired_signup_update.php
示例15: scrape
function scrape($url, $infohash = '')
{
global $TABLE_PREFIX, $BASEDIR;
if (isset($url)) {
$url_c = parse_url($url);
if (!isset($url_c["port"]) || empty($url_c["port"])) {
$url_c["port"] = 80;
}
require_once $BASEDIR . "/phpscraper/" . $url_c["scheme"] . "tscraper.php";
try {
$timeout = 5;
if ($url_c["scheme"] == "udp") {
$scraper = new udptscraper($timeout);
} else {
$scraper = new httptscraper($timeout);
}
$ret = $scraper->scrape($url_c["scheme"] . "://" . $url_c["host"] . ":" . $url_c["port"] . ($url_c["scheme"] == "udp" ? "" : "/announce"), array($infohash));
do_sqlquery("UPDATE `{$TABLE_PREFIX}files` SET `lastupdate`=NOW(), `lastsuccess`=NOW(), `seeds`=" . $ret[$infohash]["seeders"] . ", `leechers`=" . $ret[$infohash]["leechers"] . ", `finished`=" . $ret[$infohash]["completed"] . " WHERE `announce_url` = '" . $url . "'" . ($infohash == "" ? "" : " AND `info_hash`='" . $infohash . "'"), true);
if (mysqli_affected_rows($GLOBALS["___mysqli_ston"]) == 1) {
write_log('SUCCESS update external torrent from ' . $url . ' tracker (infohash: ' . $infohash . ')', '');
}
} catch (ScraperException $e) {
write_log("FAILED update external torrent " . ($infohash == "" ? "" : "(infohash: " . $infohash . ")") . " from " . $url . " tracker (" . $e->getMessage() . "))", "");
}
return;
}
return;
}
开发者ID:Karpec,项目名称:gizd,代码行数:28,代码来源:getscrape_single.php
示例16: add_comment
/**
* добавление комментария
**/
function add_comment()
{
global $connection;
$comment_author = trim(mysqli_real_escape_string($connection, $_POST['commentAuthor']));
$comment_text = trim(mysqli_real_escape_string($connection, $_POST['commentText']));
$parent = (int) $_POST['parent'];
$comment_product = (int) $_POST['productId'];
$is_admin = isset($_SESSION['auth']['is_admin']) ? $_SESSION['auth']['is_admin'] : 0;
// если нет ID товара
if (!$comment_product) {
$res = array('answer' => 'Неизвестный продукт!');
return json_encode($res);
}
// если не заполнены поля
if (empty($comment_author) or empty($comment_text)) {
$res = array('answer' => 'Все поля обязательны к заполнению');
return json_encode($res);
}
$query = "INSERT INTO comments (comment_author, comment_text, parent, comment_product, is_admin)\n\t\t\t\tVALUES ('{$comment_author}', '{$comment_text}', {$parent}, {$comment_product}, {$is_admin})";
$res = mysqli_query($connection, $query);
if (mysqli_affected_rows($connection) > 0) {
$comment_id = mysqli_insert_id($connection);
$comment_html = get_last_comment($comment_id);
return $comment_html;
} else {
$res = array('answer' => 'Ошибка добавления комментария');
return json_encode($res);
}
}
开发者ID:dimonoov,项目名称:catalog.loc,代码行数:32,代码来源:add_comment_model.php
示例17: Copyright
/**
|--------------------------------------------------------------------------|
| https://github.com/Bigjoos/ |
|--------------------------------------------------------------------------|
| Licence Info: GPL |
|--------------------------------------------------------------------------|
| Copyright (C) 2010 U-232 V5 |
|--------------------------------------------------------------------------|
| A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. |
|--------------------------------------------------------------------------|
| Project Leaders: Mindless, Autotron, whocares, Swizzles. |
|--------------------------------------------------------------------------|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/ \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \
( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e )
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
*/
function docleanup($data)
{
global $INSTALLER09, $queries, $mc1;
set_time_limit(0);
ignore_user_abort(1);
//=== Clean silver
$res = sql_query("SELECT id, silver FROM torrents WHERE silver > 1 AND silver < " . TIME_NOW) or sqlerr(__FILE__, __LINE__);
$Silver_buffer = array();
if (mysqli_num_rows($res) > 0) {
while ($arr = mysqli_fetch_assoc($res)) {
$Silver_buffer[] = '(' . $arr['id'] . ', \'0\')';
$mc1->begin_transaction('torrent_details_' . $arr['id']);
$mc1->update_row(false, array('silver' => 0));
$mc1->commit_transaction($INSTALLER09['expires']['torrent_details']);
}
$count = count($Silver_buffer);
if ($count > 0) {
sql_query("INSERT INTO torrents (id, silver) VALUES " . implode(', ', $Silver_buffer) . " ON DUPLICATE key UPDATE silver=values(silver)") or sqlerr(__FILE__, __LINE__);
write_log("Cleanup - Removed Silver from " . $count . " torrents");
}
unset($Silver_buffer, $count);
}
//==End
if ($queries > 0) {
write_log("Free clean-------------------- Silver Torrents cleanup Complete using {$queries} queries --------------------");
}
if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) {
$data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items updated";
}
if ($data['clean_log']) {
cleanup_log($data);
}
}
开发者ID:Bigjoos,项目名称:U-232-V5,代码行数:50,代码来源:silvertorrents_update.php
示例18: checkInstall
function checkInstall($lang)
{
global $install_message;
//1. check if config file exist
if (!file_exists('db.tematres.php')) {
return message("<span class=\"error\">{$install_message['201']}</span>");
} else {
message("<span class=\"success\">{$install_message['202']}</span>");
include 'db.tematres.php';
}
//2. check connection to server
if (!($linkDB = @mysqli_connect($DBCFG["Server"], $DBCFG["DBLogin"], $DBCFG["DBPass"]))) {
return message('<span class="error">' . sprintf($install_message[203], $DBCFG[Server], $DBCFG[DBLogin]) . '</span>');
} else {
message('<span class="success">' . sprintf($install_message[204], $DBCFG[Server]) . '</span>');
}
//3. check connection to database
if (!mysqli_select_db($linkDB, $DBCFG["DBName"])) {
return message('<span class="error">' . sprintf($install_message[205], $DBCFG[DBName], $DBCFG[Server]) . '</span>');
} else {
message('<span class="success">' . sprintf($install_message[206], $DBCFG[DBName], $DBCFG[Server]) . '</span>');
}
//4. check tables
$sql = mysqli_query($linkDB, "SHOW TABLES from {$DBCFG['DBName']} where Tables_in_{$DBCFG['DBName']} in ('{$DBCFG['DBprefix']}config','{$DBCFG['DBprefix']}indice','{$DBCFG['DBprefix']}notas','{$DBCFG['DBprefix']}tabla_rel','{$DBCFG['DBprefix']}tema','{$DBCFG['DBprefix']}usuario','{$DBCFG['DBprefix']}values')");
if (mysqli_affected_rows($linkDB) == '7') {
return message("<span class=\"error\">{$install_message['301']}</span>");
} else {
//Final step: dump or form
if (isset($_POST['send'])) {
$sqlInstall = SQLtematres($DBCFG, $linkDB);
} else {
echo HTMLformInstall($lang);
}
}
}
开发者ID:jpgil,项目名称:tematres-mirror,代码行数:35,代码来源:install.php
示例19: mysql_affected_rows
function mysql_affected_rows(&$c = null)
{
if (($c = mysql_global_resource($c, 1 - func_num_args())) == null) {
return;
}
return mysqli_affected_rows($c);
}
开发者ID:OOPS-ORG-PHP,项目名称:mysql-extension-wrapper,代码行数:7,代码来源:mysql-wrapper.php
示例20: setNuevoUsuario
function setNuevoUsuario($nombreCompleto, $nombre, $correo, $contrasena, $confirmar)
{
require_once 'dbm.php';
if ($nombreCompleto == "" or $nombre == "" or $correo == "" or $contrasena == "" or $confirmar == "") {
return false;
}
if ($contrasena != $confirmar) {
return false;
}
$datab = new DataBase();
$datab->open();
$connect = $datab->get_connect();
$query = "INSERT INTO usuario (nombre_completo, nombre, correo, contrasena, valoracion, rol) \r\n SELECT * FROM ( SELECT '" . $nombreCompleto . "','" . $nombre . "','" . $correo . "','" . $contrasena . "',0,'autor') AS tmp\r\n WHERE NOT EXISTS (\r\n SELECT nombre FROM usuario WHERE nombre = '" . $nombre . "') LIMIT 1;";
if (mysqli_query($connect, $query) == false) {
mysqli_close($connect);
return false;
}
$col_afectadas = mysqli_affected_rows($connect);
if ($col_afectadas == 0) {
mysqli_close($connect);
$this->nombre_completo = $nombreCompleto;
$this->nombre = $nombre;
$this->correo = $correo;
$this->contrasena = $contrasena;
return false;
}
mysqli_close($connect);
return true;
}
开发者ID:bjesua,项目名称:AirBook,代码行数:29,代码来源:user.php
注:本文中的mysqli_affected_rows函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论