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


PHP do_query函数代码示例

本文整理汇总了PHP中do_query函数的典型用法代码示例。如果您正苦于以下问题:PHP do_query函数的具体用法?PHP do_query怎么用?PHP do_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: run_sql_script

function run_sql_script($scriptlocation)
{
    if ($script = file_get_contents($scriptlocation)) {
        // global $CONFIG;
        $errors = array();
        $script = preg_replace('/\\-\\-.*\\n/', '', $script);
        $sql_statements = preg_split('/;[\\n\\r]+/', $script);
        foreach ($sql_statements as $statement) {
            $statement = trim($statement);
            // $statement = str_replace("prefix_",$CONFIG->dbprefix,$statement);
            if (!empty($statement)) {
                try {
                    $result = do_query($statement);
                } catch (Exception $e) {
                    $errors[] = $e->getMessage();
                }
            }
        }
        if (!empty($errors)) {
            $errortxt = "";
            foreach ($errors as $error) {
                $errortxt .= " {$error};";
            }
            throw new Exception('error running script: ' . $scriptlocation . ":" . $errortxt);
        }
    } else {
        throw new Exception('ScriptNotFound:' . $scriptlocation);
    }
}
开发者ID:martinkirov,项目名称:intersango,代码行数:29,代码来源:interpreter.php

示例2: show_wahlen

function show_wahlen($row)
{
    extract($row);
    $listen_gueltig = $stimmen_gesamt - $stimmzettel_ungueltig - $listen_ungueltig;
    $listen_summe = $listen_gueltig - $listen_enthaltungen;
    $kandidaten_gueltig = $stimmen_gesamt - $stimmzettel_ungueltig - $kandidaten_ungueltig;
    $kandidaten_summe = $kandidaten_gueltig - $kandidaten_enthaltungen;
    print "\\section{Wahl zum {$wahl_name}}\n";
    if (simple_query("SELECT count(*) FROM liste " . "WHERE wahl = {$wahl_id}") > 1) {
        print "\\subsection*{Listenstimmen}\n";
        // Gesamt-Informationen
        print "Wahlberechtigte: {$wahlberechtigt}, " . "abgegebene Stimmzettel: {$stimmen_gesamt}, " . "Wahlbeteiligung: " . percent($stimmen_gesamt, $wahlberechtigt) . "\\%" . "\n\n" . "ungültige Stimmzettel: {$stimmzettel_ungueltig}, " . "ungültige Stimmen: {$listen_ungueltig} " . "gültige Stimmen: {$listen_gueltig}, " . "\n\n" . "Enthaltungen: {$listen_enthaltungen} " . "\n\n";
        print "\\begin{tabular}{lrrrrl}\n" . "Liste & Stimmen & Anteil & Quote & Sitze & \\\\\\hline\n";
        // Listen-Tabelle
        do_query("SELECT liste.name_kurz, liste.name_lang, " . "anzeige_red as r, anzeige_green as g, " . "anzeige_blue as b, " . "hoechstzahl, sitze, los, " . "sum(liste_urne.stimmen) AS stimmen, " . "{$listen_summe} AS summe " . "FROM liste, urne, liste_urne " . "WHERE liste.id = liste_urne.liste " . "AND urne.id = liste_urne.urne " . "AND urne.status = " . $GLOBALS["ok_status"] . " " . "AND wahl = {$wahl_id} " . "GROUP BY liste.id " . "ORDER by liste.nummer", show_listen);
        print "\\hline\\end{tabular}\n\n";
        $num_los = simple_query("SELECT los FROM liste " . "WHERE wahl = {$wahl_id} " . "AND los > 0");
        if ($num_los > 0) {
            print "(+1): ggf. +1 von {$num_los} Restsitzen " . "per Los\n\n";
        }
    }
    // Kandidaten
    print "\\subsection*{Kandidierendenstimmen}\n";
    // Gesamt-Daten
    print "Wahlberechtigte: {$wahlberechtigt}, " . "abgegebene Stimmzettel: {$stimmen_gesamt}, " . "Wahlbeteiligung: " . percent($stimmen_gesamt, $wahlberechtigt) . "\\%" . "\n\n" . "ungültige Stimmzettel: {$stimmzettel_ungueltig}, " . "ungültige Stimmen: {$kandidaten_ungueltig}, " . "gültig: {$kandidaten_gueltig} " . "\n\n";
    if ($max_stimmen_wert == 1) {
        print "Enthaltungen: {$kandidaten_enthaltungen} " . "\n\n";
    }
    // Kandidaten
    do_query("SELECT liste.id AS liste_id, " . "liste.name_kurz AS liste_name_kurz, " . "liste.name_lang AS liste_name_lang, " . "anzeige_red AS r, " . "anzeige_green AS g, " . "anzeige_blue AS b, " . "kandidat.typ AS kandidat_typ, " . "kandidat.status AS status, " . "kandidat.vorname AS kandidat_vorname, " . "kandidat.nachname AS kandidat_nachname, " . "sum(kandidat_urne.stimmen) AS stimmen " . "FROM liste, kandidat, urne, kandidat_urne " . "WHERE kandidat.id = kandidat_urne.kandidat " . "AND urne.id = kandidat_urne.urne " . "AND liste.id = kandidat.liste " . "AND urne.status = " . $GLOBALS["ok_status"] . " " . "AND liste.wahl = {$wahl_id} " . "GROUP BY kandidat.id " . "ORDER BY liste.nummer, liste.id, status, stimmen DESC, " . "kandidat.listenplatz", show_kandidaten);
    if ($num_los != 0) {
        print "\\footnotemark{(*)} {$num_los} Restsitze werden per " . "Los auf die gekennzeichneten Listen verteilt.\n\n";
    }
}
开发者ID:asta-kit,项目名称:friwahl-legacy,代码行数:34,代码来源:ergebnisse.php

示例3: show_similar_codes

function show_similar_codes($reference)
{
    $reference = strtolower($reference);
    $result = do_query("\n            SELECT deposref, uid FROM users WHERE uid > 1\n        UNION\n            SELECT deposref, uid FROM old_deposrefs\n        ORDER BY deposref\n    ");
    while ($row = mysql_fetch_assoc($result)) {
        $deposref = strtolower($row['deposref']);
        $scores[$deposref] = round((9 + similar_text($reference, $deposref) - levenshtein($reference, $deposref)) * 100 / 18);
        $uid[$deposref] = $row['uid'];
    }
    arsort($scores);
    $first = true;
    foreach ($scores as $deposref => $score) {
        if ($score >= 50) {
            if ($first) {
                $first = false;
                echo "<p>" . _("Did you mean one of these?  Higher percentage = closer match.") . "</p>\n";
                echo "<p>" . _("Click an entry to copy it to the form below, then click 'Deposit' again.") . "</p>\n";
                echo "<table class='display_data'>\n";
                echo "<tr><th>Reference</th><th>Match</th><th>UID</th></tr>\n";
            }
            $formatted = format_deposref($deposref);
            echo "<tr", " class=\"me\"", " onmouseover=\"style.backgroundColor='#8ae3bf';\"", " onmouseout=\"style.backgroundColor='#7ad3af';\"", " onclick=\"ObjById('reference').value = '{$deposref}';\">";
            echo "<td>{$formatted}</td><td>{$score}%</td><td>{$uid[$deposref]}</td></tr>\n";
        }
    }
    if (!$first) {
        echo "</table>\n";
    }
}
开发者ID:martinkirov,项目名称:intersango,代码行数:29,代码来源:add_cash.php

示例4: run_query

function run_query()
{
    if ($_GET["search_str"] != "") {
        $tmp_var = do_query($_GET["search_str"]);
        echo json_encode($tmp_var);
    } else {
        echo json_encode(array("-1" => array("")));
    }
}
开发者ID:nmssoft,项目名称:search_service,代码行数:9,代码来源:search_service.php

示例5: get_count

function get_count()
{
    global $DB_TABLE;
    $result = do_query("SELECT DISTINCT (id) AS count FROM {$DB_TABLE}");
    $i = 0;
    while ($row = mysql_fetch_array($result)) {
        $items[$i]['count'] = $row['count'];
        $i++;
    }
    return $items;
}
开发者ID:raster,项目名称:Heard,代码行数:11,代码来源:init.php

示例6: delete_entry

function delete_entry($mode, $sendername, $senderdomain, $src)
{
    global $deleted;
    if ($mode == "email") {
        $query = "DELETE FROM from_awl WHERE sender_name='" . addslashes($sendername) . "' AND sender_domain='" . addslashes($senderdomain) . "' AND src='" . addslashes($src) . "'";
        $deleted .= "<br />" . $sendername . "@" . $senderdomain . " (" . $src . ") deleted.";
    } else {
        $query = "DELETE FROM domain_awl WHERE sender_domain='" . addslashes($senderdomain) . "' AND src='" . addslashes($src) . "'";
        $deleted .= "<br />" . $senderdomain . " (" . $src . ") deleted.";
    }
    do_query($query);
}
开发者ID:Maekess,项目名称:sgwi,代码行数:12,代码来源:awl.inc.php

示例7: get_users_graph_data

function get_users_graph_data()
{
    $users = array();
    $query = "\n        SELECT " . sql_format_date('timest') . " AS timest2\n        FROM\n            users\n        WHERE\n            uid != 1\n        ORDER BY\n            timest;\n    ";
    $result = do_query($query);
    $count = 0;
    while ($row = mysql_fetch_array($result)) {
        $timest = $row['timest2'];
        $count++;
        $users[$timest] = $count;
    }
    return $users;
}
开发者ID:martinkirov,项目名称:intersango,代码行数:13,代码来源:graph.php

示例8: del_older_than

function del_older_than($year, $month, $day, $hour, $minute, $seconds, $err)
{
    global $warning, $message;
    if ($err) {
        $warning = "Aborted: invalid date.";
    } else {
        $nicedate = $year . '-' . substr("00" . $month, -2, 2) . '-' . substr("00" . $day, -2, 2) . ' ' . substr("00" . $hour, -2, 2) . ':' . substr("00" . $minute, -2, 2) . ':' . substr("00" . $seconds, -2, 2);
        $query = "DELETE FROM connect WHERE first_seen < " . $year . substr("00" . $month, -2, 2) . substr("00" . $day, -2, 2) . substr("00" . $hour, -2, 2) . substr("00" . $minute, -2, 2) . substr("00" . $seconds, -2, 2);
        do_query($query);
        $message = 'Entries older than ' . $nicedate . ' deleted.';
        $warning = "<br />Sorting set to &#39;Seen at&#39; (ascending).";
    }
}
开发者ID:Maekess,项目名称:sgwi,代码行数:13,代码来源:connect.inc.php

示例9: make_interval_select

function make_interval_select($current)
{
    $rows = array();
    $sql = "select seconds, name from intervals order by seconds";
    $result = do_query($sql);
    while ($row = mysqli_fetch_array($result)) {
        $row['link'] = makelink("interval", $row['seconds']);
        if ($row['seconds'] == $current) {
            $row['selected'] = "selected";
        } else {
            $row['selected'] = "";
        }
        array_push($rows, $row);
    }
    return $rows;
}
开发者ID:ut0mt8,项目名称:phpflow,代码行数:16,代码来源:func.php

示例10: show_withdrawals

function show_withdrawals()
{
    echo "<div class='content_box'>\n";
    echo "<h3>" . _("Withdraw requests") . "</h3>\n";
    $result = do_query("\n        SELECT requests.reqid as reqid, uid, amount, " . sql_format_date("timest") . " as timest, name, bank, acc_num, sort_code\n        FROM requests\n        JOIN uk_requests\n        ON uk_requests.reqid = requests.reqid\n        WHERE req_type = 'WITHDR'\n          AND curr_type = '" . CURRENCY . "'\n          AND status = 'VERIFY'");
    $first = true;
    while ($row = mysql_fetch_assoc($result)) {
        if ($first) {
            $first = false;
            echo "<table class='display_data'>\n";
            echo "<tr>";
            // echo "<th>User</th>";
            echo "<th>" . CURRENCY . "</th>";
            echo "<th>Time</th>";
            echo "<th>Name</th>";
            echo "<th>Bank</th>";
            echo "<th>Account#</th>";
            echo "<th>BSB</th>";
            echo "</tr>\n";
        }
        $reqid = $row['reqid'];
        // $uid = $row['uid'];
        $amount = internal_to_numstr($row['amount']);
        $timest = $row['timest'];
        $name = $row['name'];
        $bank = $row['bank'];
        $acc_num = $row['acc_num'];
        $sort_code = $row['sort_code'];
        echo "<tr>";
        echo active_table_row("me", "?page=view_request&reqid={$reqid}&show_finish");
        // echo "<td>$uid</td>";
        echo "<td>{$amount}</td>";
        echo "<td>{$timest}</td>";
        echo "<td>{$name}</td>";
        echo "<td>{$bank}</td>";
        echo "<td>{$acc_num}</td>";
        echo "<td>{$sort_code}</td>";
        echo "</tr>\n";
    }
    if ($first) {
        echo "<p>No pending withdrawals.</p>\n";
    } else {
        echo "</table>\n";
    }
    echo "</div>\n";
}
开发者ID:martinkirov,项目名称:intersango,代码行数:46,代码来源:bank.php

示例11: summa

function summa($type)
{
    $total_in = gmp_init('0');
    $query = "\n        SELECT SUM(amount) AS sum\n        FROM purses\n        WHERE type='{$type}'\n        ";
    $result = do_query($query);
    $row = get_row($result);
    $v = gmp_init($row['sum']);
    $total_in = gmp_add($total_in, $v);
    $query = "\n        SELECT SUM(amount) AS sum\n        FROM orderbook\n        WHERE type='{$type}' AND status='OPEN'\n        ";
    $result = do_query($query);
    $row = get_row($result);
    if (isset($row['sum'])) {
        $v = gmp_init($row['sum']);
        $total_in = gmp_add($total_in, $v);
    }
    $query = "\n        SELECT SUM(amount) AS sum\n        FROM requests\n        WHERE curr_type='{$type}' AND req_type='WITHDR' AND status='VERIFY'\n        ";
    $result = do_query($query);
    $row = get_row($result);
    if (isset($row['sum'])) {
        $v = gmp_init($row['sum']);
        $total_in = gmp_add($total_in, $v);
    }
    $total_in = gmp_strval($total_in);
    $total_out = gmp_init('0');
    $query = "\n        SELECT SUM(amount) AS sum\n        FROM requests\n        WHERE curr_type='{$type}' AND req_type='DEPOS' AND status='FINAL'\n        ";
    $result = do_query($query);
    $row = get_row($result);
    if (isset($row['sum'])) {
        $v = gmp_init($row['sum']);
        $total_out = gmp_add($total_out, $v);
    }
    $query = "\n        SELECT SUM(amount) AS sum\n        FROM requests\n        WHERE curr_type='{$type}' AND req_type='WITHDR' AND status='FINAL'\n        ";
    $result = do_query($query);
    $row = get_row($result);
    if (isset($row['sum'])) {
        $v = gmp_init($row['sum']);
        $total_out = gmp_sub($total_out, $v);
    }
    $total_out = gmp_strval($total_out);
    echo "{$type} = {$total_in}\t  {$total_out}\n";
    if (gmp_cmp($total_in, $total_out) != 0) {
        echo "*********** MISMATCH ****************\n";
    }
}
开发者ID:martinkirov,项目名称:intersango,代码行数:44,代码来源:summa.php

示例12: get_orders

function get_orders()
{
    global $is_logged_in;
    $result = do_query("\n        SELECT\n            orderid, initial_amount, amount, type, initial_want_amount, want_amount, want_type\n        FROM\n            orderbook\n        WHERE\n            status = 'OPEN'\n        AND\n            uid = {$is_logged_in}\n    ");
    $orders = array();
    while ($row = mysql_fetch_array($result)) {
        $orderid = $row['orderid'];
        $have_amount = $row['amount'];
        $have_currency = $row['type'];
        $want_amount = $row['want_amount'];
        $want_currency = $row['want_type'];
        if ($have_currency == 'BTC') {
            $text = sprintf("%s %s %s %s %s %s", _("Sell"), internal_to_numstr($have_amount, BTC_PRECISION), $have_currency, _("for"), internal_to_numstr($want_amount, FIAT_PRECISION), $want_currency);
        } else {
            $text = sprintf("%s %s %s %s %s %s", _("Buy"), internal_to_numstr($want_amount, BTC_PRECISION), $want_currency, _("for"), internal_to_numstr($have_amount, FIAT_PRECISION), $have_currency);
        }
        array_push($orders, array('orderid' => $orderid, 'text' => $text, 'have_amount' => internal_to_numstr($have_amount), 'have_currency' => $row['type'], 'want_amount' => internal_to_numstr($want_amount), 'want_currency' => $want_currency));
    }
    return $orders;
}
开发者ID:martinkirov,项目名称:intersango,代码行数:20,代码来源:order_utils.php

示例13: get_article

function get_article($id)
{
    if (!($entry_all = return_query("SELECT * FROM enz_entries WHERE entry_id={$id}"))) {
        return 0;
    }
    $entry = $entry_all[0];
    if ($cache_all = return_query("SELECT * FROM enz_cache WHERE cache_id={$id}")) {
        if ($cache_all[0]['creation_date'] + 604800 > time()) {
            $entry[text] = $cache_all[0][cached_text];
        } else {
            $entry = update_crosslinks($entry);
            do_query("UPDATE enz_cache SET cached_text='{$entry['text']}',creation_date=" . time() . " WHERE cache_id={$id}");
        }
    } else {
        $entry = update_crosslinks($entry);
        do_query("INSERT INTO enz_cache (cache_id,cached_text,creation_date) VALUES ({$id},'{$entry['text']}'," . time() . ")");
    }
    $entry['text'] = stripslashes($entry['text']);
    $entry['titel'] = stripslashes($entry['titel']);
    return $entry;
}
开发者ID:halfbyte,项目名称:janzyklopedie,代码行数:21,代码来源:funcs.inc.php

示例14: fetch_depth

function fetch_depth($rate_query, $field, $have, $want)
{
    $ret = array();
    $minimum_btc_amount = numstr_to_internal(MINIMUM_BTC_AMOUNT);
    $minimum_fiat_amount = numstr_to_internal(MINIMUM_FIAT_AMOUNT);
    if ($have == "BTC") {
        $big_enough = "amount >= {$minimum_btc_amount}  AND want_amount >= {$minimum_fiat_amount}";
    } else {
        $big_enough = "amount >= {$minimum_fiat_amount} AND want_amount >= {$minimum_btc_amount} ";
    }
    $query = "\n    SELECT\n        {$rate_query} AS rate,\n        {$field} as amount\n    FROM\n        orderbook\n    WHERE\n        type='{$have}'\n        AND want_type='{$want}'\n        AND status='OPEN'\n        AND {$big_enough}\n    ORDER BY\n        rate DESC\n    ";
    $result = do_query($query);
    while ($row = mysql_fetch_assoc($result)) {
        $amount = internal_to_numstr($row['amount']);
        $rate = $row['rate'];
        //bitcoincharts uses NUMERIC(18,8)
        if ($rate < 1000000000) {
            array_push($ret, "[{$rate}, {$amount}]");
        }
    }
    return implode($ret, ", ");
}
开发者ID:martinkirov,项目名称:intersango,代码行数:22,代码来源:getDepth.php

示例15: bitcoin_withdraw

function bitcoin_withdraw($uid, $amount, $curr_type, &$voucher_code, &$reqid)
{
    $voucher = isset($_POST['voucher']);
    if ($voucher) {
        syslog(LOG_NOTICE, "address=voucher");
        $query = "\n            INSERT INTO requests (req_type, uid, amount, curr_type)\n            VALUES ('WITHDR', '{$uid}', '{$amount}', '{$curr_type}');\n        ";
    } else {
        $addy = post('address');
        try {
            $validaddy = bitcoin_validate_address($addy);
        } catch (Exception $e) {
            if ($e->getMessage() != 'Unable to connect.') {
                throw $e;
            }
            throw new Problem(_("Sorry..."), _("We are currently experiencing trouble connecting to the Bitcoin network and so cannot verify that you entered a valid Bitcoin address.") . "</p><p>" . _("Your withdrawal request has been cancelled.") . "</p><p>" . _("Please try again in a few minutes."));
        }
        if (!$validaddy['isvalid']) {
            throw new Problem(_('Bitcoin says no'), _('That address you supplied was invalid.'));
        }
        syslog(LOG_NOTICE, "address={$addy}");
        $we_have = bitcoin_get_balance("*", 0);
        if (gmp_cmp($we_have, $amount) <= 0) {
            $message = sprintf(_("User %s is asking to withdraw %s BTC.  We only have %s BTC."), $uid, internal_to_numstr($amount, BTC_PRECISION), internal_to_numstr($we_have, BTC_PRECISION));
            email_tech(_("Exchange Wallet Balance is Too Low"), $message);
        }
        $query = "\n            INSERT INTO requests (req_type, uid, amount, curr_type)\n            VALUES ('WITHDR', '{$uid}', '{$amount}', '{$curr_type}');\n        ";
    }
    endlog();
    do_query($query);
    $reqid = mysql_insert_id();
    if ($voucher) {
        $voucher_code = store_new_bitcoin_voucher_code($reqid);
    } else {
        $query = "\n            INSERT INTO bitcoin_requests (reqid, addy)\n            VALUES ('{$reqid}', '{$addy}');\n        ";
        do_query($query);
    }
}
开发者ID:martinkirov,项目名称:intersango,代码行数:37,代码来源:withdraw_utils.php


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