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


PHP pg_last_error函数代码示例

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


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

示例1: show_css_page

function show_css_page($dbconn, $diary_login)
{
    $sql = "SELECT u.uid, s.page_css FROM " . TABLE_SETTINGS . " AS s, " . TABLE_USERS . " AS u WHERE u.login='" . $diary_login . "' AND s.uid=u.uid LIMIT 1";
    $result = pg_query($dbconn, $sql) or die(pg_last_error($dbconn));
    $data = pg_fetch_object($result, NULL);
    echo $data->page_css;
}
开发者ID:BackupTheBerlios,项目名称:diarusie-svn,代码行数:7,代码来源:css.inc.php

示例2: __construct

 /** Constructor. Creates a DB connection. */
 public function __construct()
 {
     $this->conn = pg_connect("host=" . APPDB_HOST . " dbname=" . APPDB_DATABASE . " port=" . APPDB_PORT . " user=" . APPDB_USERNAME . " password=" . APPDB_PASSWORD);
     if ($this->conn == false) {
         die("Could not connect to database: " . pg_last_error());
     }
 }
开发者ID:Replica94,项目名称:SysProjE,代码行数:8,代码来源:UserDAO.class.php

示例3: getPrivacyData

 public static function getPrivacyData()
 {
     global $dbconn, $ixmaps_debug_mode;
     $sql1 = "SELECT privacy_stars.* FROM privacy_stars";
     $sql2 = "SELECT privacy_scores.* FROM privacy_scores order by asn, star_id";
     //echo $sql;
     $result1 = pg_query($dbconn, $sql1) or die('Query privacy_stars failed: ' . pg_last_error());
     $result2 = pg_query($dbconn, $sql2) or die('Query privacy_scores failed: ' . pg_last_error());
     // loop and format the data
     $stars = array();
     $scores = array();
     // stars
     while ($line1 = pg_fetch_array($result1, null, PGSQL_ASSOC)) {
         $stars[$line1['star_id']] = $line1;
     }
     while ($line2 = pg_fetch_array($result2, null, PGSQL_ASSOC)) {
         $scores[$line2['asn']][] = $line2;
     }
     //$stars = pg_fetch_all($result1);
     //$scores = pg_fetch_all($result2);
     pg_free_result($result1);
     pg_free_result($result2);
     $privacy = array('stars' => $stars, 'scores' => $scores);
     pg_close($dbconn);
     //print_r($privacy);
     return $privacy;
 }
开发者ID:agamba,项目名称:ixmaps-website,代码行数:27,代码来源:PrivacyReport.php

示例4: query

 function query($query)
 {
     if (defined('WE_ARE_TESTING')) {
         file_put_contents('/tmp/pg-query', $query . ";\n\n", FILE_APPEND);
     }
     $this->result = pg_query($this->link, $query) or $this->nicedie($query . "\n\n" . pg_last_error($this->link));
 }
开发者ID:songwork,项目名称:songwork,代码行数:7,代码来源:PgDB.php

示例5: get_points

function get_points($table_name, $show_json = FALSE)
{
    // Connecting, selecting database
    $dbconn = pg_connect("host=localhost dbname=steki_db user=postgres password=password") or die('Could not connect: ' . pg_last_error());
    // Performing SQL query
    $query = 'SELECT array_to_json(array_agg(row_to_json(t))) as ' . $table_name . '_json
    FROM (
      SELECT id, latlong[0] as latitude, latlong[1] as longitude, brand, rating, votes, nam as name, descr as description FROM "' . $table_name . '"
    ) t';
    //$query = 'SELECT row_to_json("'.$table_name.'") as '.$table_name.'_json FROM "'.$table_name.'"';
    $result = pg_query($query) or die('Query failed: ' . pg_last_error());
    // Printing results in HTML
    $json = pg_fetch_array($result, null, PGSQL_ASSOC);
    if ($show_json) {
        echo json_encode(array_values($json));
    } else {
        $str = implode("*", $json);
        $out = htmlspecialchars($str);
        echo $out;
    }
    // Free resultset
    pg_free_result($result);
    // Closing connection
    pg_close($dbconn);
    //return $json;
}
开发者ID:Jiminho,项目名称:venues,代码行数:26,代码来源:pg.php

示例6: FetchLogs

function FetchLogs($channel)
{
    $html = "";
    $c = 0;
    $logs = array();
    $display_joins = isset($_GET['data']);
    if ($display_joins) {
        $sql = "SELECT * FROM logs WHERE channel = '" . pg_escape_string($channel) . "' and time > to_timestamp( '" . pg_escape_string($_GET["start"] . " 00:00:00") . "', 'MM/DD/YYYY HH24:MI:SS' ) and time < to_timestamp( '" . pg_escape_string($_GET["end"] . " 23:59:59") . "', 'MM/DD/YYYY HH24:MI:SS' ) order by time asc;";
    } else {
        $sql = "SELECT * FROM logs WHERE channel = '" . pg_escape_string($channel) . "' and time > to_timestamp( '" . pg_escape_string($_GET["start"] . " 00:00:00") . "', 'MM/DD/YYYY HH24:MI:SS' ) and time < to_timestamp( '" . pg_escape_string($_GET["end"] . " 23:59:59") . "', 'MM/DD/YYYY HH24:MI:SS' ) and type = 0 order by time asc;";
    }
    $query = pg_query($sql);
    if (!$query) {
        die('SQL failure: ' . pg_last_error());
    }
    while ($item = pg_fetch_assoc($query)) {
        $logs[] = $item;
        $c++;
    }
    if ($c == 0) {
        return "No logs found, try a different filter";
    }
    $html .= "<p>Displaying {$c} items:</p>\n";
    if (isset($_GET["wiki"])) {
        $html .= LogsWiki::Render2($logs);
    } else {
        $html .= LogsHtml::RenderLogs($logs);
    }
    return $html;
}
开发者ID:mhutti1,项目名称:wikimedia-bot,代码行数:30,代码来源:menu.php

示例7: get_attributes

 function get_attributes()
 {
     $sql_str = "SELECT " . "name, " . "style_desc, " . "symbol_name, " . "symbol_size, " . "angle, " . "width, " . "color_r, " . "color_g, " . "color_b, " . "outlinecolor_r, " . "outlinecolor_b, " . "outlinecolor_g, " . "bgcolor_r, " . "bgcolor_g, " . "bgcolor_b " . "FROM " . "tng_mapserver_style " . "WHERE " . "id = " . $this->id;
     $this->dbconn->connect();
     $result = pg_query($this->dbconn->conn, $sql_str);
     if (!$result) {
         echo "An error occurred while executing the query - " . $sql_str . " - " . pg_last_error($this->dbconn->conn);
         //$this->dbconn->disconnect();
         return false;
     }
     // successfuly ran the query
     // store attributes
     $this->name = pg_fetch_result($result, 0, 'name');
     $this->style_desc = pg_fetch_result($result, 0, 'style_desc');
     $this->symbol_name = pg_fetch_result($result, 0, 'symbol_name');
     $this->symbol_size = pg_fetch_result($result, 0, 'symbol_size');
     $this->angle = pg_fetch_result($result, 0, 'angle');
     $this->width = pg_fetch_result($result, 0, 'width');
     $this->color_r = pg_fetch_result($result, 0, 'color_r');
     $this->color_g = pg_fetch_result($result, 0, 'color_g');
     $this->color_b = pg_fetch_result($result, 0, 'color_b');
     $this->outlinecolor_r = pg_fetch_result($result, 0, 'outlinecolor_r');
     $this->outlinecolor_g = pg_fetch_result($result, 0, 'outlinecolor_g');
     $this->outlinecolor_b = pg_fetch_result($result, 0, 'outlinecolor_b');
     $this->bgcolor_r = pg_fetch_result($result, 0, 'bgcolor_r');
     $this->bgcolor_g = pg_fetch_result($result, 0, 'bgcolor_g');
     $this->bgcolor_b = pg_fetch_result($result, 0, 'bgcolor_b');
     $this->dbconn->disconnect();
     return true;
 }
开发者ID:neskie,项目名称:Stewardship-Portal,代码行数:30,代码来源:class_ms_style.php

示例8: initTables

 /**
  * @throws SQLException
  * @return void
  */
 protected function initTables()
 {
     include_once 'creole/drivers/pgsql/metadata/PgSQLTableInfo.php';
     // Get Database Version
     $result = pg_exec($this->dblink, "SELECT version() as ver");
     if (!$result) {
         throw new SQLException("Failed to select database version");
     }
     // if (!$result)
     $row = pg_fetch_assoc($result, 0);
     $arrVersion = sscanf($row['ver'], '%*s %d.%d');
     $version = sprintf("%d.%d", $arrVersion[0], $arrVersion[1]);
     // Clean up
     $arrVersion = null;
     $row = null;
     pg_free_result($result);
     $result = null;
     $result = pg_exec($this->dblink, "SELECT oid, relname FROM pg_class\n\t\t\t\t\t\t\t\t\t\tWHERE relkind = 'r' AND relnamespace = (SELECT oid\n\t\t\t\t\t\t\t\t\t\tFROM pg_namespace\n\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t     nspname NOT IN ('information_schema','pg_catalog')\n\t\t\t\t\t\t\t\t\t\t     AND nspname NOT LIKE 'pg_temp%'\n\t\t\t\t\t\t\t\t\t\t     AND nspname NOT LIKE 'pg_toast%'\n\t\t\t\t\t\t\t\t\t\tLIMIT 1)\n\t\t\t\t\t\t\t\t\t\tORDER BY relname");
     if (!$result) {
         throw new SQLException("Could not list tables", pg_last_error($this->dblink));
     }
     while ($row = pg_fetch_assoc($result)) {
         $this->tables[strtoupper($row['relname'])] = new PgSQLTableInfo($this, $row['relname'], $version, $row['oid']);
     }
 }
开发者ID:miztaka,项目名称:teeple2,代码行数:29,代码来源:PgSQLDatabaseInfo.php

示例9: daemon_scanTime

function daemon_scanTime()
{
    require "daemon_db_init.php";
    // to initialize database connection
    // 1, get timestamp
    // $time = date("j F Y h:i:s A");
    // $timestamp = "'" . date('YmdGis') . "'";
    global $timestamp;
    // 2, check if the table "dameontimestamp" in the database "vanguardhe"
    $query_exist = "SELECT relname FROM pg_class \n\tWHERE relname = 'dameontimestamp';";
    $result_exist = pg_query($query_exist) or die('Query failed: ' . pg_last_error());
    $exist = '';
    while ($row_exist = pg_fetch_object($result_exist)) {
        $exist = $row_exist->relname;
    }
    // // 3, if not existed, create it
    if ($exist != "dameontimestamp") {
        # code...
        $query_construct = "CREATE TABLE PUBLIC.dameontimestamp(\n\t\t\tscanid SERIAL PRIMARY KEY,\n\t\t\ttime           TEXT,\n\t\t\talarmcount           TEXT );";
        $result_construct = pg_query($query_construct) or die('Query failed: ' . pg_last_error());
        pg_free_result($result_construct);
    }
    // 4, insert data into the table
    $query_insert = "INSERT INTO PUBLIC.dameontimestamp (time) VALUES ({$timestamp});";
    $result_insert = pg_query($query_insert) or die('Query failed: ' . pg_last_error());
    pg_free_result($result_exist);
    pg_free_result($result_insert);
}
开发者ID:7icken,项目名称:Network_Management_System,代码行数:28,代码来源:daemon_scanTime.php

示例10: upload

 function upload($database, $userlogin, $file, $maxsize, $extensions)
 {
     if (isset($_FILES[$file]) && $_FILES[$file]['error'] == 0) {
         $upload = false;
         $upload_dest = '../Users/Images/' . $_SESSION['login'] . '.jpg';
         if ($_FILES[$file]['size'] <= $maxsize) {
             $infosfichier = pathinfo($_FILES[$file]['name']);
             $extension_upload = $infosfichier['extension'];
             if (in_array($extension_upload, $extensions)) {
                 $upload = move_uploaded_file($_FILES[$file]['tmp_name'], $upload_dest);
             }
         } else {
             $msg = "<span class=\"red\">Photo volumineuse</span>";
         }
         if ($upload == true) {
             $photo = pg_escape_string($upload_dest);
             $query_photo = pg_query($database, "UPDATE users SET photo='{$photo}' WHERE login='{$userlogin}'") or die('Échec requête : ' . pg_last_error());
             if ($query_photo != false) {
                 $msg = "Envoi du fichier \"" . $_FILES[$file]['name'] . "\" r&eacute;ussi";
             } else {
                 $msg = "Photo envoy&eacute;e mais non ajout&eacute; &agrave; la base";
             }
             pg_free_result($query_photo);
         } else {
             $msg = "<span class=\"red\">Envoi du fichier \"" . $_FILES[$file]['name'] . "\" &eacute;chou&eacute;</span>";
         }
     } else {
         $msg = "Photo de profil supprim&eacute;e";
     }
     return $msg;
 }
开发者ID:sasd13,项目名称:website-original,代码行数:31,代码来源:editphoto.php

示例11: testUniqueCheck

 public function testUniqueCheck($username, $email)
 {
     //Get info from the array
     $final_username = $username;
     $final_email = $email;
     //Connect to the db
     $db = $this->connectProd();
     //Check for username and email address
     $query_user_check = "SELECT username FROM tb_users WHERE username = '" . $final_username . "'";
     $query_email_check = "SELECT email FROM tb_users WHERE email = '" . $final_email . "'";
     pg_send_query($db, $query_user_check) or die('Query failed: ' . pg_last_error());
     $username_check_result = pg_get_result($db);
     $username_check_result_rows = pg_num_rows($username_check_result);
     pg_close($db);
     if ($username_check_result_rows == 0) {
         //Set flag if no user found
         $user_check = 'pass';
     } else {
         $user_check = 'fail';
     }
     if ($email_check_result_rows == 0) {
         //Set flag if no email is found
         $email_check = 'pass';
     } else {
         $email_check = 'fail';
     }
     if ($email_check == 'pass' && $user_check == 'pass') {
         $check_result = 'pass';
         return $check_result;
     } else {
         $check_result = 'fail';
         return $check_result;
     }
 }
开发者ID:JackoThe1st,项目名称:OpenRPSDev,代码行数:34,代码来源:Db.php

示例12: pg_email_erro

function pg_email_erro($serro)
{
    global $secu, $base, $base_name;
    $email = 'rene@fonzaghi.com.br';
    $tee = '<table width="400" bordercolor="#ff0000" border="3" align="center">';
    $tee .= '<TR><TD bgcolor="#ff0000" align="center"><FONT class="lt2"><FONT COLOR=white><B>Erro  -' . $base . '-[' . $base_name . ']-</TD></TR>';
    $tee .= '<TR><TD><B><TT>';
    $tee .= $serro;
    $tee .= '<TR><TD><B><TT>';
    $tee .= pg_last_error();
    $tee .= '<TR><TD><B><TT>';
    $tee .= '<BR>Remote Address: ' . $_SERVER['REMOTE_ADDR'];
    $tee .= '<BR>Metodo: ' . $_SERVER['REQUEST_METHOD'];
    $tee .= '<BR>Nome da pagina: ' . $_SERVER['SCRIPT_NAME'];
    $tee .= '<BR>Dominio: ' . $_SERVER['SERVER_NAME'];
    $tee .= '<BR>Data: ' . date("d/m/Y H:i:s");
    $tee .= '</table>';
    $headers .= 'To: Rene (Monitoramento) <rene@fonzaghi.com.br>' . "\r\n";
    $headers .= 'From: BancoSQL (PG) <rene@sisdoc.com.br>' . "\r\n";
    $headers .= 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    mail($to, $subject, $message, $headers);
    mail($email, 'Erros de SQL ' . $secu, $tee, $headers);
    //	echo '<BR>e-mail enviado para '.$email ;
}
开发者ID:bireme,项目名称:proethos,代码行数:25,代码来源:sisdoc_sql.php

示例13: dbconnect

function dbconnect()
{
    //connects to the db
    $dbConnString = "host=173.254.28.90 options='--client_encoding=UTF8' user=feedmati_user dbname=feedmati_system password=PZi0wuz9n+XX";
    $dbConn = pg_connect($dbConnString) or die("Problem with connection to PostgreSQL:" . pg_last_error());
    return $dbConn;
}
开发者ID:tanliuyuan,项目名称:FeedmationWebsite,代码行数:7,代码来源:loginFunctions.php

示例14: consulta

 public function consulta($aux)
 {
     $auxcon = $this->conectar();
     $resultado = pg_query($aux) or die('La consulta fallo: ' . pg_last_error());
     pg_close($auxcon);
     return $resultado;
 }
开发者ID:RFDO93,项目名称:proyecto,代码行数:7,代码来源:cls_conexion.php

示例15: loadAvatarsWithMaxLevel

 public function loadAvatarsWithMaxLevel($accounts)
 {
     $avatars = array();
     // we will map account to avatar
     $accountParts = array_chunk($accounts, 10);
     foreach ($accountParts as $accountPart) {
         $logins = $this->makeLoginLikeQuery($accountPart);
         $sql = "select \"avatarId\", \"title\", \"race\", \"class\", \"shardName\", level, login from \"statistics\".v_avatar where {$logins} and \"isDeleted\" = false";
         $result = pg_query($this->conn, $sql);
         if (!$result) {
             throw new DBException("Failed to query avatars: " + pg_last_error($this->conn));
         }
         while ($row = pg_fetch_assoc($result)) {
             $avatar = array();
             $avatar['id'] = $row['avatarId'];
             $avatar['title'] = $row['title'];
             $avatar['race'] = $row['race'];
             $avatar['class'] = $row['class'];
             $avatar['shard'] = $row['shardName'];
             $avatar['level'] = intval($row['level']);
             $account = $row['login'];
             $old = @$avatars[$account];
             if (isset($old)) {
                 if ($old['level'] < $avatar['level']) {
                     $avatars[$account] = $avatar;
                 }
             } else {
                 $avatars[$account] = $avatar;
             }
         }
     }
     return $avatars;
 }
开发者ID:kotishe,项目名称:API-for-AOServer,代码行数:33,代码来源:AccountListLoader.inc.php


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