本文整理汇总了PHP中sql_db::find方法的典型用法代码示例。如果您正苦于以下问题:PHP sql_db::find方法的具体用法?PHP sql_db::find怎么用?PHP sql_db::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sql_db
的用法示例。
在下文中一共展示了sql_db::find方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ADDDATE
include WWW_ROOT . 'lib/db.lib.php';
include WWW_ROOT . 'lib/functions.lib.php';
include WWW_ROOT . 'lib/transact.lib.php';
include WWW_ROOT . 'lib/vps.lib.php';
include WWW_ROOT . 'lib/members.lib.php';
include WWW_ROOT . 'lib/networking.lib.php';
include WWW_ROOT . 'lib/version.lib.php';
include WWW_ROOT . 'lib/cluster.lib.php';
include WWW_ROOT . 'lib/mail.lib.php';
$db = new sql_db(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$nonpayers = "<table cellspacing=\"0\" cellpadding=\"6\" border=\"1\">\n";
$nonpayers .= "\t<tr>\n";
$nonpayers .= "\t\t<th>" . _("Nickname") . "</th>\n\t\t<th>" . _("Expiration") . "</th>\n\t\t<th>" . _("Info") . "</th>\n";
$nonpayers .= "\t</tr>\n";
$whereCond = "m_state != 'deleted' AND m_paid_until IS NOT NULL AND m_paid_until != '' AND ADDDATE(FROM_UNIXTIME(m_paid_until), INTERVAL 14 DAY) < NOW()";
while ($m = $db->find("members", $whereCond, "FROM_UNIXTIME(m_paid_until)")) {
$member = member_load($m["m_id"]);
$nonpayers .= "\t<tr>\n";
$nonpayers .= "\t\t<td>" . $member->m["m_nick"] . "</td>\n";
$nonpayers .= "\t\t<td>" . strftime("%Y-%m-%d %H:%M", $member->m["m_paid_until"]) . " (" . round(($member->m["m_paid_until"] - time()) / 60 / 60 / 24) . ")</td>\n";
$nonpayers .= "\t\t<td>" . $member->m["m_info"] . "</td>\n";
$nonpayers .= "\t</tr>\n";
}
$nonpayers .= "</table>\n";
$neverpaid = "<table cellspacing=\"0\" cellpadding=\"6\" border=\"1\">\n";
$neverpaid .= "\t<tr>\n";
$neverpaid .= "\t\t<th>" . _("Nickname") . "</th>\n\t\t<th>" . _("Created") . "</th>\n\t\t<th>" . _("Info") . "</th>\n";
$neverpaid .= "\t</tr>\n";
$whereCond = "m_state != 'deleted' AND (m_paid_until IS NULL OR m_paid_until = '') AND ADDDATE(FROM_UNIXTIME(m_created), INTERVAL 7 DAY) < NOW()";
while ($m = $db->find("members", $whereCond, "m_created")) {
$member = member_load($m["m_id"]);
示例2: strftime
$_SESSION["is_admin"] = true;
define('CRON_MODE', true);
define('DEMO_MODE', false);
// Include libraries
include WWW_ROOT . 'lib/db.lib.php';
include WWW_ROOT . 'lib/functions.lib.php';
include WWW_ROOT . 'lib/transact.lib.php';
include WWW_ROOT . 'lib/vps.lib.php';
include WWW_ROOT . 'lib/members.lib.php';
include WWW_ROOT . 'lib/networking.lib.php';
include WWW_ROOT . 'lib/version.lib.php';
include WWW_ROOT . 'lib/cluster.lib.php';
include WWW_ROOT . 'lib/mail.lib.php';
$db = new sql_db(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$whereCond = "m_mailer_enable = 1 AND m_state != 'deleted'";
while ($m = $db->find("members", $whereCond)) {
$member = member_load($m["m_id"]);
if ($member->m["m_paid_until"] - time() <= 604800) {
$subject = $cluster_cfg->get("mailer_tpl_payment_warning_subj");
$subject = str_replace("%member%", $m["m_nick"], $subject);
$content = $cluster_cfg->get("mailer_tpl_payment_warning");
$content = str_replace("%member%", $m["m_nick"], $content);
$content = str_replace("%memberid%", $m["m_id"], $content);
$content = str_replace("%expiredate%", $m["m_paid_until"] ? strftime("%Y-%m-%d", $m["m_paid_until"]) : '---', $content);
$content = str_replace("%monthly%", $m["m_monthly_payment"], $content);
send_mail($m["m_mail"], $subject, $content, $cluster_cfg->get("mailer_admins_in_cc") ? explode(",", $cluster_cfg->get("mailer_admins_cc_mails")) : array());
}
}
$rs = $db->query("SELECT v.vps_id, vps_expiration, m_nick, m_mail FROM vps v\n INNER JOIN members m ON v.m_id = m.m_id\n WHERE m_mailer_enable = 1\n AND vps_expiration IS NOT NULL\n AND vps_deleted IS NULL\n AND DATE_SUB(FROM_UNIXTIME(vps_expiration), INTERVAL 7 DAY) < NOW()\n AND FROM_UNIXTIME(vps_expiration) > NOW()");
while ($row = $db->fetch_array($rs)) {
$subject = $cluster_cfg->get("mailer_tpl_vps_expiration_subj");