当前位置: 首页>>代码示例>>PHP>>正文


PHP sql_db::fetch_array方法代码示例

本文整理汇总了PHP中sql_db::fetch_array方法的典型用法代码示例。如果您正苦于以下问题:PHP sql_db::fetch_array方法的具体用法?PHP sql_db::fetch_array怎么用?PHP sql_db::fetch_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sql_db的用法示例。


在下文中一共展示了sql_db::fetch_array方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: strftime

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");
    $subject = str_replace("%member%", $row["m_nick"], $subject);
    $subject = str_replace("%vpsid%", $row["vps_id"], $subject);
    $content = $cluster_cfg->get("mailer_tpl_vps_expiration");
    $content = str_replace("%member%", $row["m_nick"], $content);
    $content = str_replace("%vpsid%", $row["vps_id"], $content);
    $content = str_replace("%datetime%", strftime("%Y-%m-%d %H:%M", $row["vps_expiration"]), $content);
    send_mail($row["m_mail"], $subject, $content);
}
开发者ID:whedro,项目名称:vpsadmin,代码行数:31,代码来源:cron_mailer.php

示例2:

    echo '<option value="' . $tpl["templ_id"] . '">' . $tpl["templ_label"] . '</option>';
}
?>
		 	 </select>

			 <span>Preferovaná lokace pro VPS:</span>
			 <select name="location" id="location">
				<?php 
$sql = 'SELECT location_id, location_label
						FROM locations l
						INNER JOIN servers s ON l.location_id = s.server_location
						WHERE s.environment_id = ' . $db->check(ENVIRONMENT_ID) . '
						GROUP BY location_id
						ORDER BY location_id';
$rs = $db->query($sql);
while ($loc = $db->fetch_array($rs)) {
    echo '<option value="' . $loc["location_id"] . '">Master Internet ' . $loc["location_label"] . '</option>';
}
?>
			 </select>
			 <span>Měna platby:</span>
			 <select name="currency" id="currency">
 			   <option value="CZK">členský poplatek 900&nbsp;Kč na tři měsíce</option>
 			   <option value="EUR">členský poplatek 36&nbsp;eur na tři měsíce</option>			 
			 </select>
			 
			 <input type="submit" name="send" id="send" class="largeButton" value="Odeslat" onclick="signup(); return false;">
			</form>
		</div>
	</section>
开发者ID:jandanielcz,项目名称:www.vpsfree.cz,代码行数:30,代码来源:index.php

示例3: header

$_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/version.lib.php';
include WWW_ROOT . 'lib/cluster.lib.php';
$db = new sql_db(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if ($cluster_cfg->get("maintenance_mode")) {
    echo "MAINTENANCE";
    exit;
}
$rs = $db->query("SELECT server_id, server_name\n                  FROM locations l\n                  INNER JOIN servers s ON l.location_id = s.server_location\n                  WHERE server_maintenance = 0\n                  ORDER BY l.location_id, s.server_id");
$bad = false;
while ($row = $db->fetch_array($rs)) {
    $sql = 'SELECT * FROM servers_status WHERE server_id ="' . $row["server_id"] . '"';
    if ($result = $db->query($sql)) {
        $status = $db->fetch_array($result);
    }
    if (time() - $status["timestamp"] > 150) {
        if (!$bad) {
            $bad = true;
            header('HTTP/1.1 503 Service Unavailable');
        }
        echo $row["server_name"] . "\n";
    }
}
if (!$bad) {
    echo "OK";
}
开发者ID:whedro,项目名称:vpsadmin,代码行数:31,代码来源:cluster_status.php


注:本文中的sql_db::fetch_array方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。