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

PHP pg_error函数代码示例

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

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



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

示例1: pg_query

<?php 
$orz = $_POST['orz'];
?>

<form method="post" action="update.php">
	<b>ID:</b>
	<input type="text" size="40" name="id" value="<?php 
echo $orz;
?>
" readonly="value">
	<br>

	<?php 
require "dbconnect.php";
$aa = "select * from testtable where id='{$orz}'";
$result = pg_query(utf8_encode($aa)) or die(pg_error());
if (($row = pg_fetch_array($result)) != 0) {
    $bb = $row['name'];
    $cc = $row['age'];
    $dd = $row['memo'];
} else {
    $bb = ' ';
    $cc = ' ';
    $dd = ' ';
}
?>
	<b>Name:</b>
	<input type="text" size="40" name="name" value="<?php 
echo $bb;
?>
">
开发者ID:reiheng,项目名称:myweb,代码行数:31,代码来源:searchz.php


示例2: pg_connect

<?php

require_once "config.php";
$auth_host = $GLOBALS['auth_host'];
$auth_user = $GLOBALS['auth_user'];
$auth_pass = $GLOBALS['auth_pass'];
$auth_port = $GLOBALS['auth_port'];
$strConn = "host={$auth_host} port={$auth_port} dbname={$auth_dbase} user={$auth_user} password={$auth_pass}";
$db = pg_connect($strConn) or die("Error connection: " . pg_last_error());
$user_name = $_POST['name'];
$user_password = $_POST['password'];
$sql = pg_query($db, "SELECT * FROM account WHERE user_id = '{$user_name}' AND password = MD5('" . $user_password . "') ") or die(pg_error());
$rows = pg_num_rows($sql);
if ($rows > 0) {
    echo "true";
} else {
    echo "false";
}
pg_close($db);
?>
 
开发者ID:AlexGam,项目名称:TowerIsland,代码行数:20,代码来源:login.php


示例3: deleteVote

 public static function deleteVote($session_id, $user_id)
 {
     //id must be an integer
     $orig_sess_id = $session_id;
     $orig_user_id = $user_id;
     //get parsed integers
     $session_id = MyUtil::parseInt($session_id);
     $user_id = MyUtil::parseInt($user_id);
     //check
     if ($session_id == null || $user_id == null) {
         return MyUtil::fnOk(false, "Must be valid ids - session:{$orig_sess_id}, user:{$orig_user_id}", null);
     }
     $stm = "DELETE FROM " . self::$table_name . " WHERE session_id = {$session_id} AND user_id = {$user_id}";
     $result = ConnDB::query_db($stm);
     if (!$result) {
         return MyUtil::fnOk(false, pg_error(), null);
     }
     return MyUtil::fnOk(true, "", $result);
 }
开发者ID:jls14,项目名称:SpireSessions,代码行数:19,代码来源:VoteDAO.php


示例4: conectar

 function conectar($server = IP_SERVER, $user = USER_DB, $pass = PASSWORD_DB, $based = DB, $puerto = PORT, $tipo_conexion = "N")
 {
     try {
         switch ($tipo_conexion) {
             case "N":
                 // Conexion a B.D no persistente
                 $this->id_conexion = @pg_connect("host={$server} port={$puerto} dbname={$based} user={$user} password={$pass}");
                 break;
             case "P":
                 // Conexion a B.D persistente
                 $this->id_conexion = @pg_pconnect("host={$server} port={$puerto} dbname={$based} user={$user} password={$pass}");
                 break;
             default:
                 // Otros casos
                 $this->id_conexion = @pg_connect("host={$server} port={$puerto} dbname={$based} user={$user} password={$pass}");
                 break;
         }
         if ($this->id_conexion) {
             //$this->id_conexion->set_charset(CODEC);
             return $this->id_conexion;
         } else {
             throw new Exception("Error 01: " . ($this->id_conexion ? pg_error($this->id_conexion) : 'Servidor o B.D. no disponible'));
         }
     } catch (Exception $e) {
         $this->error1 = $e->getMessage();
         return null;
     }
 }
开发者ID:edmalagon,项目名称:operlog,代码行数:28,代码来源:posgresql.class.php


示例5: getUsers

 public static function getUsers($id)
 {
     $id = MyUtil::parseInt($id);
     if (!$id) {
         $id = 0;
     }
     $stm = "SELECT id, " . " creation_dt," . " email," . " facebook_id," . " first_name," . " google_id," . " img_file_path," . " img_url," . " instagram_id," . " last_name," . " phone_nbr," . " tumblr_id," . " twitter_id," . " updated_ts," . " user_type_nbr," . " username " . " FROM " . self::$table_name . " WHERE id = {$id} OR 0 = {$id}";
     $result = ConnDB::query_db($stm);
     if (!$result) {
         return MyUtil::fnOk(false, pg_error(), null);
     }
     $retArray = [];
     while ($row = pg_fetch_assoc($result)) {
         array_push($retArray, $row);
     }
     if (sizeof($retArray) > 0) {
         return MyUtil::fnOk(true, "Found Users", $retArray);
     } else {
         return MyUtil::fnOk(false, "No Results", $retArray);
     }
 }
开发者ID:jls14,项目名称:SpireSessions,代码行数:21,代码来源:UserDAO.php


示例6: error

 public static function error($err = null)
 {
     if ($err === null) {
         return pg_error();
     } else {
         return pg_error($err);
     }
 }
开发者ID:webhacking,项目名称:Textcube,代码行数:8,代码来源:Adapter.php


示例7: validaValor

<?php

function validaValor($cadena)
{
    // Funcion utilizada para validar el dato a ingresar recibido por GET
    if (eregi('^[a-zA-Z0-9._αινσϊρ‘!Ώ? -]{1,40}$', $cadena)) {
        return TRUE;
    } else {
        return FALSE;
    }
}
$valor = trim($_GET['dato']);
$campo = trim($_GET['actualizar']);
if (validaValor($valor) && validaValor($campo)) {
    // Si los campos son validos, se procede a actualizar los valores en la DB
    include 'conexion.php';
    conectar();
    // Actualizo el campo recibido por GET con la informacion que tambien hemos recibido
    pg_query("UPDATE cliente SET valor='{$valor}' WHERE id='{$campo}'") or die(pg_error());
    desconectar();
}
// No retorno ninguna respuesta
开发者ID:Jorsis,项目名称:controlprocesos,代码行数:22,代码来源:ingreso_sin_recargar_proceso.php


示例8: parse_ini_file

<?php

// Lecture du fichier de conf
$config = parse_ini_file("/etc/house-on-wire/house-on-wire.ini", true);
$db = pg_connect("host=" . $config['bdd']['host'] . " port=" . $config['bdd']['port'] . " dbname=" . $config['bdd']['dbname'] . " user=" . $config['bdd']['username'] . " password=" . $config['bdd']['password'] . " options='--client_encoding=UTF8'") or die("Erreur de connexion au serveur SQL");
$query = "SELECT ROUND( EXTRACT(EPOCH FROM date) ), papp FROM teleinfo WHERE ptec='HC';";
$result = pg_query($db, $query) or die("Erreur SQL " . pg_error());
if (!$result) {
    echo "Erreur SQL: " . pg_error();
    exit;
}
echo $_GET["callback"] . "(";
$first = TRUE;
echo "[";
while ($row = pg_fetch_row($result)) {
    echo '[' . $row[0] . ',' . $row[1] . ']';
    if ($first == FALSE) {
        echo ',';
        $first = FALSE;
    }
}
echo "]);";
开发者ID:kbenyous,项目名称:house-on-wire,代码行数:22,代码来源:all_hc.php


示例9: _error

 public function _error()
 {
     return pg_error($this->link);
 }
开发者ID:glial,项目名称:glial,代码行数:4,代码来源:Pgsql.php


示例10: foreach

		</tr>
		<tr class="entete">
                        <td>H. Pleines</td><td>H. Creuses</td><td>Total</td><td>Cout</td>
		</tr>
	</thead>
<?php 
foreach ($months as $month) {
    $result = pg_query($db, 'select to_char(\'' . $month . '\'::timestamptz, \'Month YYYY\') as month_string;') or die('Erreur SQL sur recuperation des valeurs: ' . pg_error());
    $row = pg_fetch_array($result);
    echo "                <tr class=\"content\">\n                        <td class=\"libelle\">" . $row['month_string'] . "</td>";
    foreach ($stats_ids as $id => $name) {
        $result = pg_query($db, 'select round(min_value::numeric, 1) as min_value, round(avg_value::numeric, 1) as avg_value, round(max_value::numeric, 1) as max_value from statistiques where id = \'' . $id . '\' and mois = \'' . $month . '\'') or die('Erreur SQL sur recuperation des valeurs: ' . pg_error());
        $row = pg_fetch_array($result);
        echo "            <td><div class=\"moy\">" . $row['avg_value'] . " °C</div><div class=\"delta\"><div class=\"max\">" . $row['max_value'] . " °C</div><div class=\"min\">" . $row['min_value'] . " °C</div></div></td>";
    }
    $result = pg_query($db, 'select sum(hchc)/1000 as hchc, sum(hchp)/1000 as hchp, sum(hchc+hchp)/1000 as hc, round(sum(cout_hc+cout_hp+cout_abo)::numeric, 2) as cout from teleinfo_cout where date_trunc(\'month\', date) = \'' . $month . '\' group by date_trunc(\'month\', date)') or die('Erreur SQL sur recuperation des valeurs: ' . pg_error());
    $row = pg_fetch_array($result);
    echo "                        <td>" . $row['hchc'] . "</td>\n                        <td>" . $row['hchp'] . "</td>\n                        <td>" . $row['hc'] . "</td>\n                        <td>" . $row['cout'] . "</td>\n\n                </tr>";
}
?>
	</table>
</div>

<script type="text/javascript">

  g = new Dygraph(

    // containing div
    document.getElementById("graphdiv"),
'/php/get_data_csv.php?type=temp_full&sonde=all',
{
开发者ID:kbenyous,项目名称:house-on-wire,代码行数:31,代码来源:statistiques.php


示例11: parse_ini_file

    <script type="text/javascript" src="/js/dygraph-combined.js"></script>

<style type='text/css'>
     #labels > span.highlight { border: 1px solid grey; }
    </style>
</head>
<body>
<div id="graphdiv" style="width:800px; height:600px; float:left;"></div>
<div id="labels"></div>
<p>
<b>Sondes : </b>
<?php 
// Lecture du fichier de conf
$config = parse_ini_file("/etc/house-on-wire/house-on-wire.ini", true);
$db = pg_connect("host=" . $config['bdd']['host'] . " port=" . $config['bdd']['port'] . " dbname=" . $config['bdd']['dbname'] . " user=" . $config['bdd']['username'] . " password=" . $config['bdd']['password'] . " options='--client_encoding=UTF8'") or die("Erreur de connexion au serveur SQL");
$result = pg_query($db, "SELECT * from onewire where type ='temperature' and id in ('10.22E465020800', '10.28BD65020800', '10.380166020800', '10.A8EB65020800', '10.D6F865020800', '10.EDFA65020800', '28.BB1A53030000') order by id") or die("Erreur SQL sur recuperation des valeurs: " . pg_error());
$i = 0;
$labels = array();
array_push($labels, '"Date"');
while ($row = pg_fetch_array($result)) {
    echo '<input id="' . $i . '" type="checkbox" checked="" onclick="change(this)">';
    echo '<label for="' . $i . '"> ' . $row['name'] . '</label>';
    array_push($labels, '"' . $row['name'] . '"');
    $i++;
}
?>
</p>

<script type="text/javascript">

  g = new Dygraph(
开发者ID:kbenyous,项目名称:house-on-wire,代码行数:31,代码来源:chart_full.php


示例12: pg_connect

<?php

require_once "config.php";
$auth_host = $GLOBALS['auth_host'];
$auth_user = $GLOBALS['auth_user'];
$auth_pass = $GLOBALS['auth_pass'];
$auth_dbase = $GLOBALS['auth_dbase'];
$db = pg_connect($auth_host, $auth_user, $auth_pass) or die(pg_error());
pg_select_db($auth_dbase, $db);
$username = pg_real_escape_string($_POST['name']);
$password = pg_real_escape_string($_POST['password']);
$email = pg_real_escape_string($_POST['email']);
$sql = pg_query("SELECT * FROM account WHERE user = '{$username}'");
$rows = pg_num_rows($sql);
if ($rows > 0) {
    echo "false";
} else {
    $activation = md5(uniqid(rand(), true));
    pg_query("INSERT INTO account(user,password,email) VALUES ('{$username}',MD5('" . $password . "'),'{$email}')");
    echo "true";
}
pg_close($db);
?>
 
 
开发者ID:AlexGam,项目名称:TowerIsland,代码行数:23,代码来源:createAccount.php


示例13: parse_ini_file

<?php

// Lecture du fichier de conf
$config = parse_ini_file("/etc/house-on-wire/house-on-wire.ini", true);
$db = pg_connect("host=" . $config['bdd']['host'] . " port=" . $config['bdd']['port'] . " dbname=" . $config['bdd']['dbname'] . " user=" . $config['bdd']['username'] . " password=" . $config['bdd']['password'] . " options='--client_encoding=UTF8'") or die("Erreur de connexion au serveur SQL");
$query = "SELECT MIN(papp) as min FROM teleinfo WHERE date >= ( current_timestamp - interval '24h' );";
$result = pg_query($db, $query) or die("Erreur SQL sur selection MIN() et MAX() de PAPP: " . pg_error());
$row = pg_fetch_array($result);
$papp_min_24h = $row['min'];
// Recuperation du plus vieux timestamp auquel le MIN des dernieres 24h a ete atteint
$query = "SELECT ROUND( 1000*EXTRACT( EPOCH FROM date ) ) AS when FROM teleinfo WHERE papp = " . $papp_min_24h . " AND date >= ( current_timestamp - interval '24h' ) ORDER BY date ASC LIMIT 1";
$result = pg_query($db, $query) or die("Erreur SQL sur selection MIN() et MAX() de PAPP: " . pg_error());
$row = pg_fetch_array($result);
$when_papp_min_24h = $row['when'];
echo $_GET["jqueryCallback"] . "(";
echo "{ x: {$when_papp_min_24h}, title: 'Mini 24h', text: 'Mini des dernieres 24h : {$papp_min_24h} W' })";
开发者ID:kbenyous,项目名称:house-on-wire,代码行数:16,代码来源:papp_min_24h.php


示例14: extract

<?php

include "header.php";
extract($_GET);
extract($_POST);
if ($posting == 1) {
    $sql = "insert into master_user\r\n(id_user,nama_user,password,id_store,userho,id_role) values \r\n('{$id_user}','{$nama_user}','{$password}',{$id_store},'{$userho}','{$id_role}') ";
    $rslt = pg_query($sql) or die(pg_error());
    echo pg_fetch_array($rslt);
    echo '<script language="javascript">';
    echo 'alert("Tambah Data Berhasil");';
    echo 'document.location="master_users.php"';
    echo '</script>';
}
?>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="span12">
		<!-- BEGIN PAGE TITLE & BREADCRUMB-->		
		<ul class="breadcrumb">
			<li>
				<i class="glyphicon glyphicon-home"></i>
				<a href="inside.php">Home</a> 
				<i class="icon-angle-right"></i>
			</li>
			<li>
				<a href="master_users.php" onClick="ShowListDiv();">Master Users</a>
			</li>

开发者ID:ygtrpgit,项目名称:trp,代码行数:29,代码来源:users_tambah.php


示例15: parse_ini_file

<?php

// Lecture du fichier de conf
$config = parse_ini_file("/etc/house-on-wire/house-on-wire.ini", true);
$db = pg_connect("host=" . $config['bdd']['host'] . " port=" . $config['bdd']['port'] . " dbname=" . $config['bdd']['dbname'] . " user=" . $config['bdd']['username'] . " password=" . $config['bdd']['password'] . " options='--client_encoding=UTF8'") or die("Erreur de connexion au serveur SQL");
$nb_points = $_GET['nb'];
$query = "SELECT ROUND(1000*EXTRACT(EPOCH from date)) AS when, papp FROM teleinfo ORDER BY date DESC LIMIT {$nb_points};";
$result = pg_query($db, $query) or die("Erreur SQL : " . pg_error());
$points = array();
while ($row = pg_fetch_array($result)) {
    $point = array($row['when'], $row['papp']);
    $points[] = $point;
}
header("Content-type: text/json");
echo json_encode(array_reverse($points), JSON_NUMERIC_CHECK);
开发者ID:kbenyous,项目名称:house-on-wire,代码行数:15,代码来源:papp_live.php


示例16: pg_query

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php 
require "dbconnect.php";
if ($_POST['submit']) {
    $query = "select * from testtable where id=" . $_POST['id'];
    $result = pg_query(utf8_encode($query)) or die(pg_error());
    if (($row = pg_fetch_array($result)) == 0) {
        $qq = "update testtable set name = '" . $_POST['name'] . "', age = '" . $_POST['age'] . "',memo = '" . $_POST['memo'] . "'WHERE id ='" . $_POST['id'] . "'";
        pg_query(utf8_encode($qq)) or die(pg_error());
    }
}
开发者ID:reiheng,项目名称:myweb,代码行数:11,代码来源:create_entry.php


示例17: listtable

    public function listtable($field, $sql, $link1, $link2, $par = "all")
    {
        $sColumns[0] = 'to_char(id,\'999999\')';
        $qColumns[0] = 'id';
        $x = 1;
        foreach ($field as $vs) {
            $sColumns[$x] = 'upper(' . $vs . ')';
            if ($vs[0] == '#') {
                $vs = substr($vs, 1);
                $sColumns[$x] = 'to_char(' . $vs . ',\'999999999999\')';
            }
            $aColumns[$x] = $vs;
            $qColumns[$x] = $vs;
            $x++;
        }
        $aColumns[$x] = 'id';
        $qColumns[$x] = 'id';
        /*
        		$aColumns = array( 'nik', 'nama_pegawai', 'id' );
        		$sColumns = array( 'to_char(id,\'999\')','upper(nik)', 'upper(nama_pegawai)');
        		$qColumns = array( 'id', 'nik','nama_pegawai', 'id' );
        */
        $sIndexColumn = "id";
        $sOrder = "";
        $sql1 = "";
        /* DB table to use */
        $sTable = "tb_pegawai";
        $sLimit = "";
        if (isset($_GET['iDisplayStart']) && $_GET['iDisplayLength'] != '-1') {
            $sLimit = "LIMIT " . pg_escape_string($_GET['iDisplayLength']) . " OFFSET " . pg_escape_string($_GET['iDisplayStart']);
        }
        if (isset($_GET['iSortCol_0'])) {
            $sOrder = "ORDER BY  ";
            for ($i = 0; $i < intval($_GET['iSortingCols']); $i++) {
                if ($_GET['bSortable_' . intval($_GET['iSortCol_' . $i])] == "true") {
                    $sOrder .= $qColumns[intval($_GET['iSortCol_' . $i])] . "\n\n\t\t\t\t\t\t" . pg_escape_string($_GET['sSortDir_' . $i]) . ", ";
                }
            }
            $sOrder = substr_replace($sOrder, "", -2);
            if ($sOrder == "ORDER BY") {
                $sOrder = "";
            }
        }
        $sWhere = "";
        if (isset($_GET['sSearch'])) {
            $sWhere = "WHERE (";
            for ($i = 0; $i < count($sColumns); $i++) {
                $sWhere .= $sColumns[$i] . " LIKE '%" . pg_escape_string(strtoupper($_GET['sSearch'])) . "%' OR ";
            }
            $sWhere = substr_replace($sWhere, "", -3);
            $sWhere .= ')';
        }
        for ($i = 0; $i < count($sColumns); $i++) {
            if (isset($_GET['bSearchable_' . $i]) || isset($_GET['sSearch_' . $i])) {
                if ($_GET['bSearchable_' . $i] == "true" && $_GET['sSearch_' . $i] != '') {
                    if ($sWhere == "") {
                        $sWhere = "WHERE ";
                    } else {
                        $sWhere .= " AND ";
                    }
                    $sWhere .= $sColumns[$i] . " LIKE '%" . pg_escape_string(strtoupper($_GET['sSearch_' . $i])) . "%' ";
                }
            }
        }
        $sQuery = "\n\n\t\t\tSELECT * FROM(\n\t\t\t" . $sql . ") as tbx\n\t\t\t{$sWhere}\n\n\t\t\t{$sOrder}\n\t\t\t{$sLimit}\n\n\t\t\t";
        $rResult = $this->db->query($sQuery) or die(pg_error());
        /* Data set length after filtering */
        $sQuery = "\n\n\t\t\tSELECT count(*) as jml FROM(\n\t\t\t" . $sql . ") as tbx\n\t\t\t{$sWhere}\n\n\t\t\t\t\n\n\t\t";
        #exit($sQuery);
        $rResultFilterTotal = $query = $this->db->query($sQuery) or die("Gagal");
        foreach ($query->result() as $row) {
            $iFilteredTotal = $row->jml;
        }
        /* Total data set length */
        $sQuery = "\n\n\t\t\tSELECT count(*) as jml FROM(\n\t\t\t" . $sql . ") as tbx";
        $rResultTotal = $query = $this->db->query($sQuery) or die("Gagal");
        foreach ($query->result() as $row) {
            $iTotal = $row->jml;
        }
        $sEcho = "";
        if (isset($_GET['sEcho'])) {
            $sEcho = $_GET['sEcho'];
        }
        $output = array("sEcho" => intval($sEcho), "iTotalRecords" => $iTotal, "iTotalDisplayRecords" => $iFilteredTotal, "aaData" => array());
        foreach ($rResult->result() as $r) {
            $row = array();
            $jd = count($qColumns) - 1;
            $i = 0;
            foreach ($qColumns as $v) {
                if ($i == $jd) {
                    $act = '';
                    if ($par == 'all') {
                        $act .= '<a href="' . base_url() . $link1 . '/' . $r->{$v} . '">
							  	<img src="' . base_url() . 'img/edit.gif" alt="Edit Data"></a>';
                        $act .= '<a href="#" onClick="confirmationDel(' . $r->{$v} . ',\'' . base_url() . $link2 . '\');">
								<img src="' . base_url() . 'img/del.gif" alt="Delete Data"></a>';
                    }
                    if ($par == 'edit') {
                        $act .= '<a href="' . base_url() . $link1 . '/' . $r->{$v} . '">
							  	<img src="' . base_url() . 'img/edit.gif" alt="Edit Data"></a>';
//.........这里部分代码省略.........
开发者ID:ibnoe,项目名称:appymz,代码行数:101,代码来源:getdata.php


示例18: pg_query

            </li>
<?php 
}
?>
            <li data-role="list-divider" role="heading">
                Energie
            </li>
            <li data-theme="c">
                    EDF
                    <span class="ui-li-count">
<?php 
$result = pg_query($db, " select * from (select extract(EPOCH FROM date) as ts, (hchp+hchc) as conso  from teleinfo where date >= (current_timestamp - interval '5min') order by date asc) a limit 1; ") or die("Erreur SQL sur recuperation des valeurs: " . pg_error());
$row = pg_fetch_array($result);
$ts_prec = $row["ts"];
$conso_prec = $row["conso"];
$result = pg_query($db, " select extract(EPOCH FROM date) as ts, (hchp+hchc) as conso  from teleinfo order by date desc limit 1; ") or die("Erreur SQL sur recuperation des valeurs: " . pg_error());
$row = pg_fetch_array($result);
$ts_now = $row["ts"];
$conso_now = $row["conso"];
echo round(3600 * ($conso_now - $conso_prec) / ($ts_now - $ts_prec));
?>
 W
                    </span>
            </li>
        </ul>
    </div>
</div>

</body>
</html>
开发者ID:kbenyous,项目名称:house-on-wire,代码行数:30,代码来源:index_m.php


示例19: parse_ini_file

<?php

// Lecture du fichier de conf
$config = parse_ini_file("/etc/house-on-wire/house-on-wire.ini", true);
$db = pg_connect("host=" . $config['bdd']['host'] . " port=" . $config['bdd']['port'] . " dbname=" . $config['bdd']['dbname'] . " user=" . $config['bdd']['username'] . " password=" . $config['bdd']['password'] . " options='--client_encoding=UTF8'") or die("Erreur de connexion au serveur SQL");
$query = "SELECT\n                220 * isousc as papp_max\n        FROM\n                teleinfo\n\torder by date desc\nlimit 1\n                ";
$result = pg_query($db, $query) or die("Erreur SQL sur recuperation des valeurs: " . pg_error());
// On prend les infos de la premiere sonde
$papp = pg_fetch_array($result);
$result = pg_query($db, "SELECT date, papp from teleinfo where date > current_timestamp - interval '1 minute' order by date asc") or die("Erreur SQL sur recuperation des valeurs: " . pg_error());
?>
    <script type="text/javascript">
      var data = [];
      <?php 
while ($row = pg_fetch_array($result)) {
    echo "data.push([new Date(\"" . $row["date"] . "\"), " . $row["papp"] . "]);\n";
}
?>

      var g = new Dygraph(
		document.getElementById("div_g"), 
                data,
                {
                    stepPlot: true,
                    fillGraph: true,
                    stackedGraph: true,
                  valueRange: [0, <?php 
echo $papp['papp_max'];
?>
],
//		    includeZero: true,
开发者ID:kbenyous,项目名称:house-on-wire,代码行数:31,代码来源:chart_papp_live.php


示例20: ini_set

<?php

ini_set('display_errors', 1);
//database login info
$host = 'localhost';
$port = '5432';
$dbname = 'ward';
$user = 'postgres';
$password = '2323';
$conn = pg_connect("host={$host} port={$port} dbname={$dbname} user={$user} password={$password}");
if (!$conn) {
    echo "Not connected : " . pg_error();
    exit;
}
//if a query, add those to the sql statement
if (isset($_GET['nx'])) {
    $nx = $_GET['nx'];
    $ny = $_GET['ny'];
    $ts = $_GET['ts'];
    $alfa = $_GET['alfa'];
    $sql = "UPDATE not_spatial_param SET\n          nx = {$nx},\n          ny = {$ny},\n          ts = {$ts},\n          alfa = {$alfa};";
}
$calculus = "DROP TABLE tempo;\nCREATE TABLE tempo (res float[][]);\nINSERT INTO tempo(res) values (interpol());\nDELETE FROM rasters WHERE rid = 1;\nSELECT DROPRasterConstraints ('rasters'::name, 'rast'::name);\nINSERT INTO rasters (rid, rast) VALUES (1, st_setvalues(st_addband(st_makeemptyraster((SELECT nx FROM not_spatial_param),(SELECT ny FROM not_spatial_param),(select st_xmin(geometry) from bounding_box),(select st_ymax(geometry) from bounding_box),\n(((select st_xmax(geometry) from bounding_box)-(select st_xmin(geometry) from bounding_box))/(SELECT nx FROM not_spatial_param)),(((select st_ymin(geometry) from bounding_box)-(select st_ymax(geometry) from bounding_box))/(SELECT ny FROM not_spatial_param)),0,0,3857), 1, '32BF', 1, 0), 1,1,1,(select compound_array(array[res]) from tempo)));\n        SELECT ADDRasterConstraints ('rasters'::name, 'rast'::name);\nselect * from not_spatial_param;\nselect (st_summarystats(rast)).* FROM rasters where rid = 1;";
if (!($response = pg_query($conn, $sql))) {
    echo "A query error occured.\n";
    exit;
}
if (!($response = pg_query($conn, $calculus))) {
    echo "A query error occured.\n";
    exit;
}
开发者ID:aybulatf,项目名称:local-web-site,代码行数:31,代码来源:getData.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP pg_errormessage函数代码示例发布时间:2022-05-15
下一篇:
PHP pg_end_copy函数代码示例发布时间: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