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


PHP pg_query_params函数代码示例

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


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

示例1: get_tags

/** Ota tagit tietokannasta
 * @return array
 */
function get_tags()
{
    /* $result_tags array
     * $end_array array
     */
    $dbconn = pg_connect("host=localhost port=5432 dbname=noaa user=noaa password=123");
    $result_tags = pg_query_params($dbconn, 'SELECT question_id, tag
        FROM tags
        WHERE question_id IN
        (
            SELECT question_id
            FROM tags
            WHERE tag = $1
        )
        ORDER BY question_id', array($_GET['tag']));
    while ($tags_and_Qid = pg_fetch_array($result_tags)) {
        // Add the Tag to an array of tags for that question
        $end_array[$tags_and_Qid['question_id']]['tag'][] = $tags_and_Qid['tag'];
    }
    // to check if 0 messages
    if (count($end_array) == 0) {
        header("Location: index.php?" . "no_question_found");
    } else {
        return $end_array;
    }
}
开发者ID:vilsu,项目名称:codes,代码行数:29,代码来源:handle_questions_by_tag.php

示例2: getMisc

 public function getMisc()
 {
     $query_result = $this->get('id', null, null);
     $array = $query_result->result_array();
     $infos = null;
     foreach ($array as $invite) {
         $id = $invite['id'];
         // Calcul du nombre de vols total
         $this->db->where('invite', $id);
         $this->db->from('vol');
         $infos[$id]['locations'] = $this->db->count_all_results();
         // Calcul du nombre moyen de vols par mois
         $res = pg_query_params("SELECT * FROM GSI.F_INVITE_GETMOIS(\$1)", array($id));
         $nb_mois = pg_fetch_result($res, 0, 0);
         if ($nb_mois == 0) {
             $infos[$id]['locations_par_mois'] = $infos[$id]['locations'];
         } else {
             $infos[$id]['locations_par_mois'] = round($infos[$id]['locations'] / $nb_mois, 2);
         }
         // Calcul du chiffre d'affaire
         $this->db->select_sum('prix', 'total');
         $this->db->where('invite', $id);
         $query = $this->db->get('vol');
         $row = $query->row_array();
         if ($row['total'] == null) {
             $row['total'] = 0;
         }
         $infos[$id]['chiffre_d\'affaire (€)'] = $row['total'];
     }
     return $infos;
 }
开发者ID:vincbon,项目名称:GestionParapente,代码行数:31,代码来源:Invite_model.php

示例3: order_list_by_time

function order_list_by_time($filter)
{
    //require_once('includes/sql_connection.inc.php');
    global $DBC;
    $result = pg_query_params($DBC, "SELECT \n\t\t\t\t\t\t\t\t\t\t\tdate_trunc(\$1, orderdate) as date_filter, \n\t\t\t\t\t\t\t\t\t\t\tcount(distinct orderid) as numberof_order,\n\t\t\t\t\t\t\t\t\t\t\tcount(distinct customerid) as numberof_customer,\n\t\t\t\t\t\t\t\t\t\t\tcount(distinct prod_id) as numberof_prod,\n\t\t\t\t\t\t\t\t\t\t\tsum(quantity) as quantity_by_time,\n\t\t\t\t\t\t\t\t\t\t\tsum(total) as total_by_time \n\t\t\t\t\t\t\t\t\t\tFROM orders NATURAL JOIN orderlines\n\t\t\t\t\t\t\t\t\t\tGROUP BY date_filter\n\t\t\t\t\t\t\t\t\t\tORDER BY total_by_time DESC", array($filter));
    if ($result) {
        $order_list_by_time = pg_fetch_all($result);
        switch ($filter) {
            case 'day':
                $format = 'D d/M/Y';
                break;
            case 'week':
                $format = 'W M/Y';
                break;
            case 'month':
                $format = 'M/Y';
                break;
            case 'year':
                $format = 'Y';
                break;
            default:
                break;
        }
        for ($i = 0; $i < count($order_list_by_time); $i++) {
            echo '<tr>
	                                                    <td>' . date($format, strtotime($order_list_by_time[$i]['date_filter'])) . '</td>
	                                                    <td>' . $order_list_by_time[$i]['numberof_order'] . '</td>
	                                                    <td>' . $order_list_by_time[$i]['numberof_customer'] . '</td>
	                                                    <td>' . $order_list_by_time[$i]['numberof_prod'] . '</td>                                                    
	                                                    <td>' . $order_list_by_time[$i]['quantity_by_time'] . '</td>
	                                                    <td style="font-weight: bold;" class="price">' . round($order_list_by_time[$i]['total_by_time']) . '</td>
	                                                </tr>';
        }
    }
}
开发者ID:kiendt07,项目名称:thecoffeehouse,代码行数:35,代码来源:revenue.php

示例4: sex_ratio_ft

function sex_ratio_ft()
{
    global $DBC;
    $result = pg_query_params($DBC, "\n\t\t\t\t\t\t\t\t\t\tWITH men_number_tb AS(\nSELECT count(customerid) AS men_number FROM customers WHERE sex='M' AND user_group_id=2\n)\nSELECT round(avg(men_number) / count(customerid), 2) FROM customers, men_number_tb WHERE user_group_id=2\n\n\t\t\t\t\t\t\t\t\t\t", array());
    $row = pg_fetch_array($result);
    echo $row[0];
}
开发者ID:kiendt07,项目名称:thecoffeehouse,代码行数:7,代码来源:sex_ratio.php

示例5: exec

 public function exec($query, $params = array(), $html_safe = true, $debug = false)
 {
     // Process the request.
     if ($debug) {
         echo "<pre>" . $query . "</pre><br />";
     }
     if ($html_safe) {
         foreach ($params as &$p) {
             $p = htmlspecialchars($p);
         }
     }
     $result = pg_query_params($this->db, $query, $params);
     if (!$result) {
         echo "<b>Query Failed:</b><pre>" . $query . "</pre><br />";
     }
     // Check for errors.
     $pg_error = pg_last_error();
     // If there are errors, put them in the error list
     if (strlen($pg_error) > 0) {
         $this->errors .= $pg_error;
         echo $pg_error;
         return false;
     } else {
         return new PgSqlResult($result);
     }
 }
开发者ID:regality,项目名称:Zombie-PHP-Website,代码行数:26,代码来源:pgsql_connection.php

示例6: num_of_customer_ft

function num_of_customer_ft()
{
    global $DBC;
    $result = pg_query_params($DBC, "SELECT count(customerid) FROM customers WHERE user_group_id = \$1", array(2));
    $row = pg_fetch_array($result);
    echo $row[0];
}
开发者ID:kiendt07,项目名称:thecoffeehouse,代码行数:7,代码来源:customer.php

示例7: check_serviceprovider_unlocked

function check_serviceprovider_unlocked($id)
{
    $query = "select record_locked from techmatcher.serviceprovider where serviceprovider_id = \$1";
    $result = pg_query_params($query, array($id));
    $value = pg_fetch_row($result);
    return $value;
}
开发者ID:nkpajsmith,项目名称:nealsgit2,代码行数:7,代码来源:login_logout_dao.php

示例8: get_original_passhash_md5

/** Ota salasanan hash tietokannasta
 * @return string
 */
function get_original_passhash_md5()
{
    $dbconn = pg_connect("host=localhost port=5432 dbname=noaa user=noaa password=123");
    if (!$dbconn) {
        echo "An error occurred - Hhhh\n";
        exit;
    }
    if (!empty($_POST['login']['email'])) {
        $result = pg_query_params($dbconn, 'SELECT passhash_md5 
            FROM users
            WHERE email=$1', array($_POST['login']['email']));
        while ($row = pg_fetch_array($result)) {
            /* 
             * $passhash_md5 string
             */
            $passhash_md5 = $row['passhash_md5'];
        }
    } else {
        if (!empty($_SESSION['login']['email'])) {
            $result = pg_query_params($dbconn, 'SELECT passhash_md5 
            FROM users
            WHERE email=$1', array($_SESSION['login']['email']));
            while ($row = pg_fetch_array($result)) {
                $passhash_md5 = $row['passhash_md5'];
            }
        }
    }
    return $passhash_md5;
}
开发者ID:vilsu,项目名称:codes,代码行数:32,代码来源:login_by_session.php

示例9: getSubsTypeDetailDesc

function getSubsTypeDetailDesc($subscriber_type)
{
    $qry = "select  productname,   productdescription, subcriptionrate as subscriptionrate  \nfrom techmatcher.subscriptiontype where  subscribertype_id =\$1  order by subscriptionrate asc";
    $result = pg_query_params($qry, array($subscriber_type));
    $value = pg_fetch_all($result);
    return $value;
}
开发者ID:nkpajsmith,项目名称:nealsgit2,代码行数:7,代码来源:subscription.php

示例10: comprobar_nick_modificar

function comprobar_nick_modificar(&$error, $nick, $id)
{
    $res = pg_query_params("select * from usuarios where nick = \$1 and id != \$2", array($nick, $id));
    if (pg_num_rows($res) > 0) {
        $error[] = "nick cogido. Escoja otro.";
    }
}
开发者ID:ricpelo,项目名称:juguetoon,代码行数:7,代码来源:modificar_auxiliar.php

示例11: getStartEndDate

function getStartEndDate($cons_id)
{
    $query = "select subscriptioneffectivedate,subscriptionenddate from techmatcher.currentsubscribers_vw where itconsumer_id = \$1;";
    $result = pg_query_params($query, array($cons_id));
    $row = pg_fetch_row($result);
    return $row;
}
开发者ID:nkpajsmith,项目名称:nealsgit2,代码行数:7,代码来源:email.php

示例12: get_provider_data

function get_provider_data($provider_id)
{
    $qry = pg_query_params("select sp_home_page, contactemail from techmatcher.serviceprovider where serviceprovider_id=\$1", array($provider_id)) or die(pg_errormessage());
    $result = pg_fetch_assoc($qry);
    $_SESSION['provider']['contactemail'] = $result['contactemail'];
    return $result["sp_home_page"];
}
开发者ID:nkpajsmith,项目名称:nealsgit2,代码行数:7,代码来源:provider.php

示例13: comprobar_tiene_cita

function comprobar_tiene_cita($id_usuario)
{
    $res = pg_query_params("select * from citas where id_usuario = \$1", array($id_usuario));
    if (pg_num_rows($res) > 0) {
        return true;
    }
    return false;
}
开发者ID:mariosumd,项目名称:citas,代码行数:8,代码来源:auxiliar.php

示例14: updateProviderBillingAddress

function updateProviderBillingAddress($provider_id, $address1, $address2, $city, $state, $zipcode, $phone)
{
    $qry = "select aa.address_id from techmatcher.serviceprovidertoaddress it,techmatcher.address aa where it.serviceprovider_id=\$1 and aa.addresstype_id=4 AND aa.address_id = it.address_id and it.address_deleted=\$2;";
    $r1 = pg_query_params($qry, array($cons_id, 'FALSE'));
    $r2 = pg_fetch_all($r1);
    $address_id = $r2[0]['address_id'];
    pg_query_params("Update techmatcher.address set addressline1 =\$1, addressline2 =\$2,city= \$3, state = \$4, country = \$5, zipcode = \$6, phonenumber= \$7 Where address_id=\$8", array($address1, $address2, $city, $state, 'USA', $zipcode, $phone, $address_id));
}
开发者ID:nkpajsmith,项目名称:nealsgit2,代码行数:8,代码来源:address.php

示例15: query

 public function query()
 {
     $this->sqlResult = pg_query_params($this->con, $this->statement, $this->params);
     if (!$this->sqlResult) {
         unset($this->sqlResult);
         throw new DBException("Result in a query lead to an error.");
     }
 }
开发者ID:JCBenjamin,项目名称:WB,代码行数:8,代码来源:sqlDB.php


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