本文整理汇总了PHP中DbConn::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP DbConn::fetch方法的具体用法?PHP DbConn::fetch怎么用?PHP DbConn::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbConn
的用法示例。
在下文中一共展示了DbConn::fetch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_note
function delete_note($noteid)
{
$db = new DbConn();
$result = $db->fetch('select userid from notes where id = ?');
if ($result) {
$db->exec('delete from notes where id = ?', $noteid);
log_event(LOG_NOTE_DELETED, $result->userid, $noteid);
}
}
示例2: get_user_by_email
function get_user_by_email($email)
{
$db = new DbConn();
return $db->fetch('select * from users where email = ?', $email);
}
示例3: get_mail_template
function get_mail_template($template_id, $throw_on_not_found = FALSE)
{
$mail_template = FALSE;
if ($template_id) {
$db = new DbConn();
$mail_template = $db->fetch('select mtv.*, mt.role, mt.recipient, mt.allowdupes, mt.recurrence
from mail_templates as mt
left join (mail_template_versions as mtv)
on mt.id = mtv.templateid
where mt.id = ?
order by id desc', $template_id);
}
if ($throw_on_not_found && !$mail_template) {
throw new RuntimeException("Mail template #{$template_id} not found");
}
if ($mail_template) {
$attachments = $db->query('select ma.id, ma.filename, ma.size
from mail_attachments as ma, templatevers_to_attachments as t2a
where ma.id = t2a.attachmentid and t2a.templateverid = ?', $mail_template->id);
$mail_template->attachments = $attachments;
}
return $mail_template;
}
示例4: DbConn
function get_volunteer_coordinator()
{
$db = new DbConn();
return $db->fetch('select name, email from admins where iscoordinator = 1');
}