本文整理汇总了PHP中db_find_one函数的典型用法代码示例。如果您正苦于以下问题:PHP db_find_one函数的具体用法?PHP db_find_one怎么用?PHP db_find_one使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_find_one函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: banip_read_by_ip
function banip_read_by_ip($ip)
{
$ip = long2ip(ip2long($ip));
// 安全过滤
$arr = explode('.', $ip);
$banip = db_find_one("SELECT * FROM `bbs_banip` WHERE ip0='{$arr['0']}' AND ip1='{$arr['1']}' AND ip2='{$arr['2']}' AND ip3='{$arr['3']}' LIMIT 1");
banip_format($banip);
return $banip;
}
示例2: table_day_cron
function table_day_cron($crontime = 0)
{
global $time;
$crontime = $crontime ? $crontime : $time;
list($y, $m, $d) = explode('-', date('Y-n-j', $crontime));
// 往前推8个小时,确保在前一天。
$table_map = array('bbs_thread' => 'tid', 'bbs_post' => 'pid', 'bbs_user' => 'uid');
foreach ($table_map as $table => $col) {
$arr = db_find_one("SELECT MAX(`{$col}`) maxid FROM `{$table}` WHERE create_date<{$crontime}");
$maxid = $arr['maxid'];
$arr = db_find_one("SELECT COUNT(*) `count` FROM `{$table}` WHERE create_date<{$crontime}");
$count = $arr['count'];
db_exec("REPLACE INTO bbs_table_day SET `year`='{$y}', `month`='{$m}', `day`='{$d}', `create_date`='{$crontime}', `table`='{$table}', `maxid`='{$maxid}', `count`='{$count}'");
}
}
示例3: online__read
function online__read($sid)
{
return db_find_one("SELECT * FROM `bbs_online` WHERE sid='{$sid}'");
}
示例4: user_read
function user_read($uid)
{
return db_find_one("SELECT * FROM `test_user` WHERE uid='{$uid}'");
}
示例5: friendlink_read
function friendlink_read($linkid)
{
return db_find_one("SELECT * FROM `bbs_friendlink` WHERE linkid='{$linkid}'");
}
示例6: thread_url_read_by_url
function thread_url_read_by_url($url)
{
$arr = db_find_one("SELECT * FROM bbs_thread_url WHERE url='{$url}'");
return $arr ? $arr['tid'] : 0;
}
示例7: modlog__read
function modlog__read($logid)
{
return db_find_one("SELECT * FROM `bbs_modlog` WHERE logid='{$logid}'");
}
示例8: forum_access_count
function forum_access_count($cond = array())
{
$cond = cond_to_sqladd($cond);
$arr = db_find_one("SELECT COUNT(*) AS num FROM `bbs_forum_access` {$cond}");
return $arr['num'];
}
示例9: ipaccess_read
function ipaccess_read($ip)
{
return db_find_one("SELECT * FROM `bbs_ipaccess` WHERE ip='{$ip}'");
}
示例10: group__read
function group__read($gid)
{
return db_find_one("SELECT * FROM `bbs_group` WHERE gid='{$gid}'");
}
示例11: qq_login_read_user_by_openid
function qq_login_read_user_by_openid($openid)
{
$arr = db_find_one("SELECT * FROM bbs_user_open_plat WHERE openid='{$openid}'");
if ($arr) {
$arr2 = user_read($arr['uid']);
if ($arr2) {
$arr = array_merge($arr, $arr2);
} else {
db_exec("DELETE FROM bbs_user_open_plat WHERE openid='{$openid}'");
return FALSE;
}
}
return $arr;
}
示例12: chdir
/*
功能:操作数据库
注意:发生错误的时候,返回 FALSE
*/
chdir('../../../');
// 请修改配置文件,设置正确的 mysql 账号密码
$conf = (include './simple/4/conf.php');
include './xiunophp/xiunophp.php';
// 创建表
$r = db_exec("DROP TABLE IF EXISTS `test_user`");
$r = db_exec("CREATE TABLE `test_user` (\n uid int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '用户编号',\n username char(32) NOT NULL DEFAULT '' COMMENT '用户名',\n password char(32) NOT NULL DEFAULT '' COMMENT '密码',\n PRIMARY KEY (uid)\n) ENGINE=MyISAM DEFAULT CHARSET=utf8");
// 插入数据
$r = db_exec("INSERT INTO `test_user` SET username='Jack'");
$r = db_exec("INSERT INTO `test_user` SET username='Tom'");
// 查找一条数据
$arr = db_find_one("SELECT * FROM `test_user` WHERE username='Jack'");
print_r($arr);
// 查找多条数据
$arrlist = db_find("SELECT * FROM `test_user` WHERE uid>0");
print_r($arrlist);
/*
结果输出:
Array
(
[uid] => 1
[username] => Jack
)
Array
(
[0] => Array
(
示例13: article__read
function article__read($articleid)
{
return db_find_one("SELECT * FROM `bbs_article` WHERE articleid='{$articleid}'");
}
示例14: mythread_read
function mythread_read($uid, $tid)
{
return db_find_one("SELECT * FROM `bbs_mythread` WHERE uid='{$uid}' AND tid='{$tid}' LIMIT 1");
}
示例15: define
<?php
define('APP_NAME', 'test');
chdir(getcwd() . '/../');
include './XiunoPHP.3.0.php';
$user = db_find_one("SELECT * FROM `user` WHERE uid='1'");
x('select', $user['uid'], '1');
$r = db_exec("INSERT INTO user SET uid=1000, username='test1000'");
x('insert', $r, 1000);
$arr = db_find_one("SELECT * FROM user WHERE uid='1000'");
x('select', $arr['uid'], '1000');
$r = db_exec("DELETE FROM user WHERE uid='1000'");
x('insert', $r, 1);
$r = db_find_one("SELECT * FROM user WHERE uid='0'");
x('select', $r, NULL);
function x($info, $a, $b)
{
echo "{$info}: ... " . ($a === $b ? 'true' : 'false' . ", " . var_export($a, 1) . ", " . var_export($b, 1)) . "\r\n";
}