Exemplo n.º 1
1
function ap_clients($ap)
{
    $result = @pg_select($dbconn, "ap_clients", array("mac" => "{$ap}"));
    if (!$result) {
        $result = @pg_select($dbconn, "ap_clients", array("ip" => "{$ap}"));
        if (!$result) {
            echo "Erro AP não encontrado!\n";
            return false;
        }
    }
    pg_close($dbconn);
    print $result[0]["num_clients"];
}
Exemplo n.º 2
0
<?php

error_reporting(E_ALL);
include 'config.inc';
$db = pg_connect($conn_str);
$fields = array('num' => '1234', 'str' => 'ABC', 'bin' => 'XYZ');
$ids = array('num' => '1234');
$res = pg_select($db, $table_name, $ids) or print "Error\n";
var_dump($res);
echo pg_select($db, $table_name, $ids, PGSQL_DML_STRING) . "\n";
echo "Ok\n";
Exemplo n.º 3
0
	function p_select($table,$array,$options=NULL){
	// Experimental
	// pg_select to select from a table the values in array that match ?	
		$result = ($options == NULL ? pg_select($this->db, $table, $array) : pg_select($this->db,$table,$array,$options));
		return $result? $result:false;
	}
Exemplo n.º 4
0
<?php

include 'config.inc';
$conn = pg_connect($conn_str);
pg_query('CREATE SCHEMA phptests');
pg_query('CREATE TABLE phptests.foo (id INT, id2 INT)');
pg_insert($conn, 'foo', array('id' => 1, 'id2' => 1));
pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2));
var_dump(pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2), PGSQL_DML_STRING));
var_dump(pg_select($conn, 'phptests.foo', array('id' => 1)));
pg_query('DROP TABLE phptests.foo');
pg_query('DROP SCHEMA phptests');
Exemplo n.º 5
0
<?php

include 'config.inc';
$conn = pg_connect($conn_str);
pg_query('CREATE SCHEMA phptests');
pg_query('CREATE TABLE phptests.foo (id INT, id2 INT)');
pg_query('INSERT INTO phptests.foo VALUES (1,2)');
pg_query('INSERT INTO phptests.foo VALUES (2,3)');
pg_query('CREATE TABLE phptests.bar (id4 INT, id3 INT)');
pg_query('INSERT INTO phptests.bar VALUES (4,5)');
pg_query('INSERT INTO phptests.bar VALUES (6,7)');
/* Inexistent table */
var_dump(pg_select($conn, 'foo', array('id' => 1)));
/* Existent column */
var_dump(pg_select($conn, 'phptests.foo', array('id' => 1)));
/* Testing with inexistent column */
var_dump(pg_select($conn, 'phptests.bar', array('id' => 1)));
/* Existent column */
var_dump(pg_select($conn, 'phptests.bar', array('id4' => 4)));
pg_query('DROP TABLE phptests.foo');
pg_query('DROP TABLE phptests.bar');
pg_query('DROP SCHEMA phptests');
Exemplo n.º 6
0
 public function select_db($dbName)
 {
     $this->dbname = $dbName;
     @pg_select($this->link, $dbName);
 }