• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP pg_Exec函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: exec_query

function exec_query($connection, $query)
{
    $result = pg_Exec($connection, $query);
    if (!$result) {
        echo "Connection to database failed.";
        echo pg_ErrorMessage($connection);
        return 0;
    }
    return $result;
}
开发者ID:pierrechtux,项目名称:QCV,代码行数:10,代码来源:database_functions.php


示例2: StandaloneQuery

 function StandaloneQuery(&$db, $query)
 {
     if (($connection = $db->DoConnect("template1", 0)) == 0) {
         return 0;
     }
     if (!($success = @pg_Exec($connection, "{$query}"))) {
         $db->SetError("Standalone query", pg_ErrorMessage($connection));
     }
     pg_Close($connection);
     return $success;
 }
开发者ID:BackupTheBerlios,项目名称:zvs,代码行数:11,代码来源:manager_pgsql.php


示例3: execQuery

 public function execQuery($name, $query)
 {
     if ($GLOBALS['DB_DEBUG']) {
         echo $query . '<br>';
     }
     if ($this->connection) {
         $this->freeResult($name);
         $this->result[$name] = pg_Exec($this->connection, $query);
     }
     $this->row = 0;
     return $this->result[$name];
 }
开发者ID:rawork,项目名称:colors-life,代码行数:12,代码来源:pgConnector.php


示例4: execute

 function execute($sql, $db, $type = "mysql")
 {
     $start = $this->row * $this->numrowsperpage;
     if ($type == "mysql") {
         $result = mysql_query($sql, $db);
         $this->total_records = mysql_num_rows($result);
         $sql .= " LIMIT {$start}, {$this->numrowsperpage}";
         $result = mysql_query($sql, $db);
     } elseif ($type == "pgsql") {
         $result = pg_Exec($db, $sql);
         $this->total_records = pg_NumRows($result);
         $sql .= " LIMIT {$this->numrowsperpage}, {$start}";
         $result = pg_Exec($db, $sql);
     }
     return $result;
 }
开发者ID:wborbajr,项目名称:TecnodataApp,代码行数:16,代码来源:navbar.php


示例5: execute

 function execute($sql, $db, $type = "mysql")
 {
     global $total_records, $row, $numtoshow;
     $numtoshow = $this->numrowsperpage;
     if (!isset($row)) {
         $row = 0;
     }
     $start = $row * $numtoshow;
     if ($type == "mysql") {
         $result = mysql_query($sql, $db);
         $total_records = mysql_num_rows($result);
         $sql .= " LIMIT {$start}, {$numtoshow}";
         $result = mysql_query($sql, $db);
     } elseif ($type == "pgsql") {
         $result = pg_Exec($db, $sql);
         $total_records = pg_NumRows($result);
         $sql .= " LIMIT {$numtoshow}, {$start}";
         $result = pg_Exec($db, $sql);
     }
     return $result;
 }
开发者ID:redrock,项目名称:xlrstats-web-v2,代码行数:21,代码来源:inc_recordnav.php


示例6: fcdb_query_single_value

function fcdb_query_single_value($stmt)
{
    global $fcdb_sel, $fcdb_conn;
    set_error_handler("fcdb_error_handler");
    switch ($fcdb_sel) {
        case "PostgreSQL":
            $res = pg_Exec($fcdb_conn, $stmt);
            if (!$res) {
                build_fcdb_error("I cannot run a query: '{$stmt}'.");
            }
            $val = pg_Result($res, 0, 0);
            break;
        case "MySQL":
            $res = mysql_query($stmt, $fcdb_conn);
            if (!$res) {
                build_fcdb_error("I cannot run a query: '{$stmt}'.");
            }
            $val = mysql_result($res, 0, 0);
            break;
    }
    restore_error_handler();
    return $val;
}
开发者ID:andreasrosdal,项目名称:freeciv-web,代码行数:23,代码来源:fcdb.php


示例7: listOptionsLabel

function listOptionsLabel($dataset, $choixdef)
{
    global $database;
    $result = pg_Exec($database, "SELECT * FROM " . $dataset);
    $Nbr = pg_NumRows($result);
    for ($i = 0; $i < $Nbr; $i++) {
        $tablo[$i] = pg_fetch_array($result, $i);
    }
    if ($Nbr > 2) {
        sort($tablo);
    }
    echo "<select name=liste_" . $dataset . ">\n";
    for ($i = 0; $i < $Nbr; $i++) {
        list($cle, $label) = $tablo[$i];
        if ($cle == $choixdef) {
            echo "  <option selected>" . $cle . " = " . $label . "</option>\n";
        } else {
            echo "  <option>" . $cle . " = " . $label . "</option>\n";
        }
    }
    echo "</select>\n";
    return 1;
}
开发者ID:pierrechtux,项目名称:QCV,代码行数:23,代码来源:inc_select.php


示例8: execute

 function execute($sql, $db, $type = "mysql")
 {
     global $total_records, $row, $numtoshow;
     $numtoshow = $this->numrowsperpage;
     if (!isset($_GET['row'])) {
         $row = 0;
     } else {
         $row = $_GET['row'];
     }
     $start = $row * $numtoshow;
     if ($type == "mysql") {
         // echo " the sql statement is --".$sql."and Db is --".$db;
         $query_result = mysql_query($sql, $db);
         //$total_records = mysql_num_rows($query_result);
         $sql .= " LIMIT {$start}, {$numtoshow}";
         $query_result = mysql_query($sql, $db);
     } elseif ($type == "pgsql") {
         $query_result = pg_Exec($db, $sql);
         $total_records = pg_NumRows($query_result);
         $sql .= " LIMIT {$numtoshow}, {$start}";
         $query_result = pg_Exec($db, $sql);
     }
     return $query_result;
 }
开发者ID:sraj4,项目名称:EthicsPublicHtmlProd,代码行数:24,代码来源:navbar.php


示例9: Sincronizar

function Sincronizar($db)
{
    $rows = 0;
    // Number of rows
    $qid = 0;
    // Query result resource
    // See PostgreSQL developer manual (www.postgresql.org) for system table spec.
    // Get catalog data from system tables.
    $sql = 'SELECT * FROM migracion.f_sincronizacion()';
    $qid = pg_Exec($db, $sql);
    // Check error
    if (!is_resource($qid)) {
        print 'Error en la Sincronizacion';
        return null;
    }
    $rows = pg_NumRows($qid);
    // Store meta data
    for ($i = 0; $i < $rows; $i++) {
        $res = pg_Result($qid, $i, 0);
        // Field Name
    }
    echo 'Sincronizacion terminada (' . $res . ')  - ' . date("m-d-Y H:i:s") . '<BR>';
    return $res;
}
开发者ID:rensi4rn,项目名称:ADQUI_BOA,代码行数:24,代码来源:ActionSincronizarPXP.php


示例10: Setup

 function Setup()
 {
     if (!function_exists("pg_connect")) {
         return "PostgreSQL support is not available in this PHP configuration";
     }
     $this->supported["Sequences"] = $this->supported["Indexes"] = $this->supported["SummaryFunctions"] = $this->supported["OrderByText"] = $this->supported["Transactions"] = $this->supported["GetSequenceCurrentValue"] = $this->supported["SelectRowRanges"] = $this->supported["LOBs"] = $this->supported["Replace"] = $this->supported["AutoIncrement"] = $this->supported["PrimaryKey"] = $this->supported["OmitInsertKey"] = $this->supported["OmitInsertKey"] = $this->supported["PatternBuild"] = 1;
     if (function_exists("pg_cmdTuples")) {
         if ($connection = $this->DoConnect("template1", 0)) {
             if ($result = @pg_Exec($connection, "BEGIN")) {
                 $error_reporting = error_reporting(63);
                 @pg_cmdTuples($result);
                 if (!isset($php_errormsg) || strcmp($php_errormsg, "This compilation does not support pg_cmdtuples()")) {
                     $this->supported["AffectedRows"] = 1;
                 }
                 error_reporting($error_reporting);
             } else {
                 $this->SetError("Setup", pg_ErrorMessage($connection));
             }
             pg_Close($connection);
         } else {
             $result = 0;
         }
         if (!$result) {
             return $this->Error();
         }
     }
     if (isset($this->options["EmulateDecimal"]) && $this->options["EmulateDecimal"]) {
         $this->emulate_decimal = 1;
         $this->decimal_factor = pow(10.0, $this->decimal_places);
     }
     return "";
 }
开发者ID:wycus,项目名称:darmedic,代码行数:32,代码来源:metabase_pgsql.php


示例11: GetLastInsertID

 function GetLastInsertID($sTable)
 {
     @($res = pg_Exec($this->conn, "select currval('seq_{$sTable}')"));
     if ($res) {
         $Record = @pg_fetch_array($res, 0);
         @pg_FreeResult($res);
         return $Record[0];
     }
     trigger_error("Error getting last insert ID for table {$sTable}! " . pg_ErrorMessage());
     return -1;
 }
开发者ID:ljvblfz,项目名称:mysoftwarebrasil,代码行数:11,代码来源:class.DCL_DB_pgsql.inc.php


示例12: _standaloneQuery

 /**
  * execute a query
  *
  * @param string $query
  * @return
  * @access private
  */
 function _standaloneQuery($query)
 {
     if (($connection = $this->_doConnect('template1', 0)) == 0) {
         return $this->raiseError(MDB_ERROR_CONNECT_FAILED, NULL, NULL, '_standaloneQuery: Cannot connect to template1');
     }
     if (!($result = @pg_Exec($connection, $query))) {
         $this->raiseError(MDB_ERROR, NULL, NULL, '_standaloneQuery: ' . @pg_errormessage($connection));
     }
     pg_Close($connection);
     return $result;
 }
开发者ID:ookwudili,项目名称:chisimba,代码行数:18,代码来源:pgsql.php


示例13: header

<!DOCTYPE html>
<html>
<head>
	<title>Conexión Exitosa</title>
</head>

<body>
<font color="hotpink"><h1>Bienvenid@</h1></font>
<?php 
/*Conexion con la base de datos*/
header("Content-type: text/html; charset=utf8");
$v_usuario = $_POST["username"];
$v_password = $_POST["password"];
$v_tabla = $_POST["tabla"];
$conexion = pg_connect("host=localhost port=5432 dbname=eventos user={$v_usuario} password={$v_password}");
echo "Datos de la tabla <b>{$v_tabla}</b>";
echo "<BR>";
echo "<BR>";
if ($v_tabla == "evento") {
    $sql = "select * from {$v_tabla}";
    $resultado_set = pg_Exec($conexion, $sql);
    while ($row = pg_fetch_array($resultado_set)) {
        echo $row["cod_evento"] . ". <i>Nombre evento: </i>" . $row["nom_evento"] . " <i>Fecha: </i>" . $row["fecha_evento"] . " <i>Participantes: </i>" . $row["num_part_evento"] . " <i>Lugar: </i>" . $row["lug_evento"];
        echo "<BR>";
    }
}
pg_close($conexion);
?>
</body>
</html>
开发者ID:vivianamarquez,项目名称:Bases-de-Datos,代码行数:30,代码来源:conectar.php


示例14: get_last_insert_id

 /**
  * Find the primary key of the last insertion on the current db connection
  *
  * @param string $table name of table the insert was performed on
  * @param string $field the autoincrement primary key of the table
  * @return integer the id, -1 if fails
  */
 public function get_last_insert_id($table, $field = '')
 {
     switch ($GLOBALS['phpgw_info']['server']['db_type']) {
         case 'postgres':
             $params = explode('.', $this->adodb->pgVersion);
             if ($params[0] < 8 || $params[0] == 8 && $params[1] == 0) {
                 $oid = pg_getlastoid($this->adodb->_resultid);
                 if ($oid == -1) {
                     return -1;
                 }
                 $result = @pg_Exec($this->adodb->_connectionID, "select {$field} from {$table} where oid={$oid}");
             } else {
                 $result = @pg_Exec($this->adodb->_connectionID, "select lastval()");
             }
             if (!$result) {
                 return -1;
             }
             $Record = @pg_fetch_array($result, 0);
             @pg_freeresult($result);
             if (!is_array($Record)) {
                 return -1;
             }
             return $Record[0];
             break;
         case 'mssql':
             /*  MSSQL uses a query to retrieve the last
              *  identity on the connection, so table and field are ignored here as well.
              */
             if (!isset($table) || $table == '' || !isset($field) || $field == '') {
                 return -1;
             }
             $result = @mssql_query("select @@identity", $this->adodb->_queryID);
             if (!$result) {
                 return -1;
             }
             return mssql_result($result, 0, 0);
             break;
         default:
             return $this->adodb->Insert_ID($table, $field);
     }
 }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:48,代码来源:class.db_adodb.inc.php


示例15: query

 function query(&$db, $query = "")
 {
     // Constructor of the query object.
     // executes the query, notifies the db object of the query result to clean
     // up later
     if ($query != "") {
         if (!empty($this->result)) {
             $this->free();
             // query not called as constructor therefore there may
             // be something to clean up.
         }
         $this->result = @pg_Exec($db->connect_id, $query);
         $db->addquery($this->result);
         $this->curr_row = 0;
         $this->query = $query;
     }
 }
开发者ID:carriercomm,项目名称:xmec,代码行数:17,代码来源:postgresql.php


示例16: _query

 function _query($sql, $inputarr)
 {
     $rez = pg_Exec($this->_connectionID, $sql);
     // check if no data returned, then no need to create real recordset
     if ($rez && pg_numfields($rez) <= 0) {
         $this->_resultid = $rez;
         return true;
     }
     return $rez;
 }
开发者ID:BackupTheBerlios,项目名称:osiswebprinter,代码行数:10,代码来源:adodb-postgres64.inc.php


示例17: unset

         unset($_SESSION["acct_canon"]);
     }
     $_SESSION["acct_official"] = $_SESSION["acct_canon"] ? $_SESSION["acct_canon"] : $_SESSION["acct_username"];
     if (!$addition) {
         $account = findAccount($_SESSION["acct_official"]);
         if ($account === false) {
             $id = createAccount();
             addAccountUsername($id, $_SESSION["acct_official"], $_SESSION["acct_username"]);
             setAccountDetails($id, $sreg);
             if (isset($_COOKIE["pbguid"])) {
                 setAccountGUID($id, $_COOKIE["pbguid"]);
             }
             setAccountAPIKey($id, makeApiKey());
             $account = findAccount($_SESSION["acct_official"]);
         } else {
             pg_Exec($DB, "UPDATE accounts SET last_login=now() WHERE id=" . $account['id']);
         }
         $_SESSION["acct_id"] = $account['id'];
         $_SESSION["acct_sreg"] = $account;
         $_SESSION["kvp"] = findAccountKVP($account['id']);
     } else {
         pageHeader(_("new OpenID associated"));
         pageSidebar();
         makeSection(_("your new OpenID has been associated"));
         print '<p>Thank you! Your new OpenID username has been associated with this account. You may now <a href="/settings.php">continue with more settings</a>.</p>';
         pageFooter();
         exit;
     }
 } else {
     print "Sorry, there was a general authentication failure.. <a href=\"/login.php\">Please try again.</a>";
     exit;
开发者ID:slepp,项目名称:pastebin.ca,代码行数:31,代码来源:oid_inline_finish.php


示例18: getValueFromDB2

function getValueFromDB2($tabl, $var, $qValues, $dbName)
{
    $newConn = pg_connect('dbname=' . $dbName);
    $SQLstmt = "SELECT {$var} FROM {$tabl} WHERE " . where_list($qValues) . ";";
    if (!$newConn) {
        echo "<!-- Couldn't connect to {$dbName} -->\n";
    }
    //echo "<!-- $SQLstmt -->\n";
    $result = pg_Exec($newConn, $SQLstmt);
    if (!$result) {
        echo "<p>Query failed to {$dbName} <br>";
        echo $SQLstmt . "<br />\n";
        echo pg_errormessage($newConn);
        $x = '';
    } else {
        $x = pg_result($result, 0, $var);
    }
    pg_free_result($result);
    pg_close($newConn);
    return $x;
}
开发者ID:quercusluver,项目名称:tfrec-web-dev,代码行数:21,代码来源:toolBoxV3.php


示例19: pg_connect

</head>
<body>
<form>
	<center><td colspan='2' align='center'><h1><font color="red">Adicionar clientes</h1></font></td></center>
	<table align='center' width='225' cellspacing='2' cellpadding='2' border='0'>	
</form>
<form>
<left><td colspan='2' align='left'><h3>Cliente insertado</h3></td></left>
<table align='left' width='100' cellspacing='2' cellpadding='2' border='0'>
</form>

<?php 
$v_cod_cliente = $_GET["cod_cliente"];
$v_nom_cliente = "'" . $_GET["nom_cliente"] . "'";
$conexion = pg_connect("host=192.168.6.55 port=5432 dbname=ventas user=postgres password=1234") or die('failed');
$sql = "INSERT INTO cliente(cod_cliente, nom_cliente) VALUES({$v_cod_cliente}, {$v_nom_cliente})";
$result = pg_Exec($conexion, $sql);
$sql = "select cod_cliente, nom_cliente from cliente where cod_cliente = {$v_cod_cliente}";
$result = pg_Exec($conexion, $sql);
while ($row = pg_fetch_array($result)) {
    echo $row["cod_cliente"] . "-->" . $row["nom_cliente"];
}
echo "<br>";
?>
<form method='get' action='opciones.php'>
<br>
	<input type='submit' value='Close'>
</form>
</body>
</html>
开发者ID:vivianamarquez,项目名称:Bases-de-Datos,代码行数:30,代码来源:insertardatos2.php


示例20: pg_Exec

$user_no = "";
$query = "SELECT user_no FROM usr WHERE username=LOWER('{$l}') and password=LOWER('{$p}')";
$result = pg_Exec($dbconn, $query);
if (pg_NumRows($result) > 0) {
    $user_no = pg_Result($result, 0, "user_no");
}
$requests = "<p><small>";
if ("{$user_no}" != "") {
    $query = "SELECT DISTINCT request.request_id, brief, last_activity, ";
    $query .= "lookup_desc AS status_desc, severity_code ";
    $query .= "FROM request, request_interested, lookup_code AS status ";
    $query .= "WHERE request.request_id=request_interested.request_id ";
    $query .= "AND status.source_table='request' ";
    $query .= "AND status.source_field='status_code' ";
    $query .= "AND status.lookup_code=request.last_status ";
    $query .= "AND request_interested.user_no={$user_no} ";
    $query .= "AND request.active ";
    $query .= "AND request.last_status~*'[AILNRQA]' ";
    $query .= "ORDER BY request.severity_code DESC LIMIT 20; ";
    $result = pg_Exec($dbconn, $query);
    if (!$result) {
        error_log("wrms wap/inc/getRequests.php query error: {$query}", 0);
    }
    for ($i = 0; $i < pg_NumRows($result); $i++) {
        $thisrequest = pg_Fetch_Object($result, $i);
        $requests .= "<a href=\"wrms.php?id={$thisrequest->request_id}\">" . tidy($thisrequest->brief) . "</a><br/>\n";
    }
} else {
    $requests .= "I'm sorry you must login first";
}
$requests .= "</small></p>";
开发者ID:Br3nda,项目名称:wrms,代码行数:31,代码来源:getRequests.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP pg_NumRows函数代码示例发布时间:2022-05-15
下一篇:
PHP pg_ErrorMessage函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap