本文整理汇总了PHP中db_find函数的典型用法代码示例。如果您正苦于以下问题:PHP db_find函数的具体用法?PHP db_find怎么用?PHP db_find使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_find函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modlog__find
function modlog__find($cond = array(), $orderby = array(), $page = 1, $pagesize = 20)
{
$cond = cond_to_sqladd($cond);
$orderby = orderby_to_sqladd($orderby);
$offset = ($page - 1) * $pagesize;
return db_find("SELECT * FROM `bbs_modlog` {$cond}{$orderby} LIMIT {$offset},{$pagesize}");
}
示例2: group__find
function group__find($cond = array(), $orderby = array(), $page = 1, $pagesize = 1000)
{
$cond = cond_to_sqladd($cond);
$orderby = orderby_to_sqladd($orderby);
$offset = ($page - 1) * $pagesize;
$grouplist = db_find("SELECT * FROM `bbs_group` {$cond}{$orderby} LIMIT {$offset},{$pagesize}", 'gid');
return $grouplist;
}
示例3: thread_top_find
function thread_top_find($fid = 0)
{
if ($fid == 0) {
$threadlist = db_find("SELECT * FROM `bbs_thread_top` WHERE top=3 ORDER BY tid DESC LIMIT 100", 'tid');
} else {
$threadlist = db_find("SELECT * FROM `bbs_thread_top` WHERE fid='{$fid}' AND top=1 ORDER BY tid DESC LIMIT 100", 'tid');
}
$tids = arrlist_values($threadlist, 'tid');
$threadlist = thread_find_by_tids($tids, 1, 100);
return $threadlist;
}
示例4: forum_delete
function forum_delete($fid)
{
// 把板块下所有的帖子都查找出来,此处数据量大可能会超时,所以不要删除帖子特别多的板块
$threadlist = db_find("SELECT tid, uid FROM `bbs_thread` WHERE fid='{$fid}'");
foreach ($threadlist as $thread) {
thread_delete($thread['tid']);
}
$r = forum__delete($fid);
forum_list_cache_delete();
return $r;
}
示例5: friendlink_find
function friendlink_find($cond = array(), $orderby = array(), $page = 1, $pagesize = 1000)
{
$cond = cond_to_sqladd($cond);
$orderby = orderby_to_sqladd($orderby);
$offset = ($page - 1) * $pagesize;
$friendlinklist = db_find("SELECT * FROM `bbs_friendlink` {$cond}{$orderby} LIMIT {$offset},{$pagesize}", 'linkid');
if ($friendlinklist) {
foreach ($friendlinklist as &$friendlink) {
friendlink_format($friendlink);
}
}
return $friendlinklist;
}
示例6: thread_new_find
function thread_new_find()
{
$threadlist = db_find("SELECT * FROM `bbs_thread_new` ORDER BY tid DESC LIMIT 100");
if (empty($threadlist)) {
$threadlist = thread_find(array(), array('tid' => -1), 1, 100);
foreach ($threadlist as $thread) {
thread_new_create($thread['tid']);
}
} else {
$tids = arrlist_values($threadlist, 'tid');
$threadlist = thread_find_by_tids($tids, 1, 100, 'tid');
}
return $threadlist;
}
示例7: thread_lastpid_find
function thread_lastpid_find()
{
$threadlist = db_find("SELECT * FROM `bbs_thread_lastpid` ORDER BY lastpid DESC LIMIT 100");
if (empty($threadlist)) {
// 此处特殊情况,一般不会执行到此处,无须索引
$threadlist = thread_find(array(), array('lastpid' => -1), 1, 100);
foreach ($threadlist as $thread) {
thread_lastpid_create($thread['tid'], $thread['lastpid']);
}
} else {
$tids = arrlist_values($threadlist, 'tid');
$threadlist = thread_find_by_tids($tids, 1, 100, 'lastpid');
}
return $threadlist;
}
示例8: forum_access_find_by_fid
function forum_access_find_by_fid($fid)
{
$accesslist = db_find("SELECT * FROM `bbs_forum_access` WHERE fid='{$fid}' ORDER BY gid ASC LIMIT 100", 'gid');
return $accesslist;
}
示例9: attach_gc
function attach_gc()
{
global $time, $conf;
$attachlist = db_find("SELECT * FROM bbs_attach WHERE pid='0'");
if (empty($attachlist)) {
return;
}
foreach ($attachlist as $attach) {
// 如果是 1 天内的附件,则不处理,可能正在发帖
if ($time - $attach['create_date'] < 86400) {
continue;
}
$filepath = $conf['upload_path'] . $attach['filename'];
is_file($filepath) and unlink($filepath);
}
}
示例10: post_find_by_pids
function post_find_by_pids($pids)
{
if (empty($pids)) {
return array();
}
$sqladd = implode(',', $pids);
return db_find("SELECT * FROM bbs_post WHERE pid IN({$sqladd})");
}
示例11: ini_set
<?php
require_once "../../phplib/util.php";
ini_set('memory_limit', '512000000');
$lexems = db_find(new Lexem(), 'restriction like "%S%" or restriction like "%P%"');
$count = count($lexems);
foreach ($lexems as $lexem) {
print "Regenerez {$lexem->form} {$lexem->modelType}{$lexem->modelNumber}{$lexem->restriction} ({$count} rămase)\n";
$lexem->regenerateParadigm();
$count--;
}
示例12: getopt
<?php
require_once '../phplib/util.php';
require_once '../phplib/ads/adsModule.php';
require_once '../phplib/ads/diverta/divertaAdsModule.php';
$opts = getopt('s:');
if (count($opts) != 1) {
print "Usage: fixDivertaBooks -s <start-id>\n";
exit;
}
// Resolve some ambiguities automatically. List the form that is alphabetically first and specify what to return
$PREFERRED_FORMS = array('a' => 'a', 'al' => 'al', 'carte' => 'carte', 'cartea' => 'cartea', 'clasa' => 'clasa', 'fara' => 'fără', 'i' => 'i', 'ii' => 'ii', 'in' => 'în', 'la' => 'la', 'mai' => 'mai', 'mare' => 'mare', 'marea' => 'marea', 'povesti' => 'povești', 'print' => 'prinț', 'printul' => 'prințul', 's' => 's', 'sa' => 'să', 'si' => 'și', 'teste' => 'teste', 'ti' => 'ți', 'timp' => 'timp', 'top' => 'top');
$books = db_find(new DivertaBook(), "id >= {$opts['s']} order by id");
foreach ($books as $book) {
print "Loaded: {$book->id} [{$book->title}] [{$book->url}]\n";
$origTitle = $book->title;
// Preliminary stuff
$book->title = trim($book->title);
if (text_endsWith($book->title, ', ***')) {
$book->title = substr($book->title, 0, -5);
}
switch ($book->sku) {
case 'YDA00965':
$book->title = 'Dicționar vizual spaniol-român';
break;
case 'YHG00310':
$book->title = '77 de rețete celebre și poveștile lor';
break;
case 'YHU02030':
$book->title = 'Zen aici și acum';
break;
示例13: count
if (count($lexems) != 1) {
print "I {$longInfForm} are " . count($lexems) . " lexeme corespunzătoare\n";
}
foreach ($lexems as $longInf) {
if (!$longInf->isLoc) {
print "I {$longInf->formNoAccent} nu este în LOC {$LEXEM_EDIT_URL}{$longInf->id}\n";
$longInf->isLoc = 1;
$longInf->save();
}
}
}
if ($verb->modelType == 'VT') {
$ifs = db_find(new InflectedForm(), "lexemId = {$verb->id} and inflectionId = {$INFL_PART}");
$pm = ParticipleModel::loadByVerbModel($verb->modelNumber);
assert($pm);
foreach ($ifs as $if) {
$partForm = $if->formNoAccent;
$lexems = db_find(new Lexem(), "formNoAccent = '{$partForm}' and modelType = 'A' and modelNumber = '{$pm->adjectiveModel}'");
if (count($lexems) != 1) {
print "P {$partForm} are " . count($lexems) . " lexeme corespunzătoare\n";
}
foreach ($lexems as $part) {
if (!$part->isLoc) {
print "P {$part->formNoAccent} nu este în LOC {$LEXEM_EDIT_URL}{$part->id}\n";
$part->isLoc = 1;
$part->save();
}
}
}
}
}
示例14: lookup
function lookup($sourceId, $cuv, $fd)
{
if (!source_exists($sourceId)) {
socket_write($fd, "550 invalid database, use SHOW DB for a list\r\n");
return;
}
if ($sourceId == '*' || $sourceId == '!') {
$sourceId = 0;
}
$cuv = StringUtil::cleanupQuery($cuv);
$arr = StringUtil::analyzeQuery($cuv);
$field = $arr[0] ? 'formNoAccent' : 'formUtf8General';
$lexems = db_find(new Lexem(), "{$field} = '{$cuv}' order by formNoAccent");
$definitions = Definition::loadForLexems($lexems, $sourceId, $cuv);
$searchResults = SearchResult::mapDefinitionArray($definitions);
if (!count($definitions)) {
socket_write($fd, "552 no match\r\n");
return;
}
socket_write($fd, "150 " . count($definitions) . " definition(s) found\r\n");
foreach ($searchResults as $sr) {
$def = pretty_print($sr->definition->internalRep);
socket_write($fd, "151 \"" . $cuv . "\" " . $sr->source->id . " \"" . $sr->source->name . "\"\r\n");
socket_write($fd, "{$cuv}\r\n{$def}");
socket_write($fd, ".\r\n");
}
socket_write($fd, "250 ok\r\n");
}
示例15: chdir
*/
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
(
[uid] => 1
[username] => Jack
)