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


PHP SQL::fetch_all方法代码示例

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


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

示例1: filterContent

 public function filterContent(Comments $comment)
 {
     if (!is_string($check_text)) {
         return $check_text;
     }
     $sql = new SQL();
     $sql->query("select word from filter where level = 2");
     $arr = $sql->fetch_all();
     if (!empty($arr)) {
         foreach ($arr as $v) {
             if (strstr($check_text, $v['word'])) {
                 $check_text = $this->replaceChar($check_text, $v['word']);
             }
         }
     }
     return $check_text;
 }
开发者ID:skybird,项目名称:phalcon,代码行数:17,代码来源:Filter.php

示例2:

    case 'y':
        $_ENV['title'] = 'Income Statement: Y:' . $this->date_alpha_f . ' to ' . $this->date_omega_f;
        break;
    default:
        $_ENV['title'] = 'Income Statement: ' . $this->date_alpha_f . ' to ' . $this->date_omega_f;
        break;
}
// Revenues
$sql = " select a.id as account_id,a.code as account_code, a.full_code, a.name as full_name,sum(b.amount) as balance from ";
$sql .= " account a join account_ledger b on a.id=b.account_id join account_journal c on b.account_journal_id=c.id ";
$sql .= " where a.kind like 'Revenue%' and c.date >= '{$this->date_alpha}' and c.date<='{$this->date_omega}' ";
if ('true' == $_GET['xc']) {
    $sql .= " and c.kind != 'C' ";
}
$sql .= " group by a.id,a.full_code,a.code,a.name ";
$sql .= " order by a.full_code,a.code ";
//echo "<p>$sql</p>";
$this->RevenueAccountList = SQL::fetch_all($sql);
Session::flash('fail', SQL::lastError());
// Expenses
$sql = " select a.id as account_id,a.code as account_code, a.full_code, a.name as full_name,sum(b.amount) as balance from ";
$sql .= " account a join account_ledger b on a.id=b.account_id join account_journal c on b.account_journal_id=c.id ";
$sql .= " where a.kind like 'Expense%' and c.date >= '{$this->date_alpha}' and c.date<='{$this->date_omega}' ";
if ('true' == $_GET['xc']) {
    $sql .= " and c.kind != 'C' ";
}
$sql .= " group by a.id,a.full_code,a.code,a.name ";
$sql .= " order by a.full_code,a.code ";
//echo "<p>$sql</p>";
$this->ExpenseAccountList = SQL::fetch_all($sql);
Session::flash('fail', SQL::lastError());
开发者ID:rahmanazhar,项目名称:imperium,代码行数:31,代码来源:income.php

示例3: abs

        $sql .= ' abs(amount) = ? OR account_journal_id = ? ';
        $arg[] = abs($q_term);
        $arg[] = intval($q_term);
        break;
    case 'amount':
        $sql .= ' abs(amount) = ? ';
        $arg[] = abs($q_term);
        break;
    case 'open':
    default:
        $sql .= ' note ~* ? ';
        $arg[] = $q_term;
        // OR date = ? ';
}
$sql .= ' ORDER BY date DESC, kind DESC, account_journal_id, amount ';
$res = SQL::fetch_all($sql, $arg);
Session::flash('fail', SQL::lastError());
if (empty($res) || 0 == count($res)) {
    Session::flash('info', 'No Matching Transactions');
    return 0;
}
echo '<table>';
foreach ($res as $rec) {
    echo '<tr class="rero">';
    if ($rec['account_journal_id'] != $account_journal_id_x) {
        // Date
        echo '<td class="c"><a href="' . Radix::link('/account/transaction?id=' . $rec['account_journal_id']) . '">' . date('m/d/y', strtotime($rec['date'])) . '</a></td>';
        // Name & Note
        echo '<td>' . html($rec['note']) . '</td>';
        echo '</tr>';
        echo '<tr><td>&nbsp;</td>';
开发者ID:rahmanazhar,项目名称:imperium,代码行数:31,代码来源:search.php

示例4: count

$sql = 'SELECT count(id) FROM invoice ';
$sql .= ' WHERE status IN (\'Active\') ';
$sql .= ' AND (extract(days from current_timestamp - date) > ?) ';
$res = SQL::fetch_one($sql, array($cli_opt['span']));
echo "<p>" . $res . " Active Invoices to POST</p>\n";
$sql = 'SELECT count(id) FROM invoice ';
$sql .= ' WHERE status IN (\'Hawk\', \'Sent\') ';
$sql .= ' AND (extract(days from current_timestamp - date) > ?) ';
$res = SQL::fetch_one($sql, array($cli_opt['span']));
echo "<p>" . $res . " Sent Invoices over {$cli_opt['span']} days old</p>\n";
// Find Hawkable Invoices
$sql = 'SELECT *, extract(days from current_timestamp - date) as days FROM invoice ';
$sql .= ' WHERE status IN (\'Hawk\', \'Sent\') ';
// $sql.= ' AND ((extract(days from current_timestamp - date)::integer % ?) = 0) ';
$sql .= ' ORDER BY date, contact_id, id ASC ';
$res = SQL::fetch_all($sql);
// , array($cli_opt['span']));
echo "<p>Past Due Invoices: " . count($res) . "</p>\n";
$sum = 0;
foreach ($res as $rec) {
    $iv = new Invoice($rec);
    $co = new Contact($rec['contact_id']);
    $bal = floatval($rec['bill_amount']) - floatval($rec['paid_amount']);
    echo "<p>Customer: {$co['name']} {$co['email']}</p>\n";
    echo "<p>Invoice #{$iv['id']}/{$iv['status']} \${$bal} from {$iv['date']} ({$rec['days']} due)</p>\n";
    if (empty($co['email'])) {
        echo "<p style='color:#f00;font-weight:bold;'>FAIL: No Email for this Contact!</p>\n";
        continue;
    }
    // List of Invoices
    // $sql = 'SELECT * FROM invoice ';
开发者ID:rahmanazhar,项目名称:imperium,代码行数:31,代码来源:cron-invoice-hawk.php

示例5: _draw_details

    $html .= _draw_details($res);
} else {
    $html .= "<p>No Pending Work</p>\n";
}
// echo "Active Work:\n";
// _draw_details($res);
// Completed Work - From Yesterday
$html .= "<h2>Completed Work</h2>\n";
$date = strftime('%Y-%m-%d', $time - 86400);
$sql = 'SELECT workorder_item.*,contact.name as contact_name ';
$sql .= '  FROM workorder_item';
$sql .= '  JOIN workorder ON workorder_item.workorder_id = workorder.id ';
$sql .= '  JOIN contact ON workorder.contact_id = contact.id ';
$sql .= '  WHERE workorder_item.date = ? AND workorder_item.status = ? ';
$sql .= '  ORDER BY workorder_item.workorder_id';
$res = SQL::fetch_all($sql, array($date, 'Complete'));
if (count($res)) {
    $html .= _draw_details($res);
} else {
    $html .= "<p>No Completed Work</p>\n";
}
$html .= '</body>';
$html .= '</html>';
// Make New Message
// http://www.emailonacid.com/blog/details/C13/the_importance_of_content-type_character_encoding_in_html_emails
$head = array();
$head['Content-Transfer-Encoding'] = '8bit';
$head['Content-Type'] = 'text/html; charset="UTF-8"';
$head['From'] = sprintf('"%s" <%s>', $_ENV['company']['name'], $_ENV['mail']['from']);
$head['MIME-Version'] = '1.0';
$head['Message-Id'] = md5(openssl_random_pseudo_bytes(256)) . '@' . parse_url($_ENV['application']['base'], PHP_URL_HOST);
开发者ID:rahmanazhar,项目名称:imperium,代码行数:31,代码来源:cron-daily-summary.php


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