本文整理匯總了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');
}