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


PHP pg_error函数代码示例

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


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


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