本文整理汇总了PHP中Dal::all_assoc方法的典型用法代码示例。如果您正苦于以下问题:PHP Dal::all_assoc方法的具体用法?PHP Dal::all_assoc怎么用?PHP Dal::all_assoc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dal
的用法示例。
在下文中一共展示了Dal::all_assoc方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
static function search($text, $limit = 0)
{
$text = Dal::quote($text);
$limit_sql = $limit ? " LIMIT {$limit}" : "";
$sth = Dal::query("SELECT content_id, comment_id FROM {comments} WHERE is_active = 1 AND (name LIKE '%{$text}%' OR subject LIKE '%{$text}%' OR homepage LIKE '%{$text}%' OR comment LIKE '%{$text}%') {$limit_sql}");
return Dal::all_assoc($sth);
}
示例2: get_recent_content_for_user
static function get_recent_content_for_user($uid, $content_type, $limit)
{
$tables = array(IMAGE => "images", AUDIO => "audios", VIDEO => "videos");
$other_table = $tables[$content_type];
$sth = Dal::query("SELECT * FROM contents C\n LEFT JOIN {$other_table} I ON C.content_id=I.content_id\n WHERE C.type=? AND C.author_id=? AND C.is_active=1\n ORDER BY C.created DESC\n LIMIT {$limit}", array($content_type, $uid));
return Dal::all_assoc($sth);
}
示例3: find_associated_domains
public function find_associated_domains()
{
$sth = Dal::query("SELECT sd.domain domain, dic2.domain_id domain_id, COUNT(dic2.domain_id) match_count\n FROM spam_domains sd, domains_in_comments dic1, domains_in_comments dic2\n WHERE dic1.domain_id=? AND dic1.comment_id=dic2.comment_id AND sd.id=dic2.domain_id\n GROUP BY dic2.domain_id ORDER BY match_count DESC", array($this->id));
return Dal::all_assoc($sth);
}