Created
May 31, 2015 03:56
-
-
Save nihilismus/ab41247e27ef2c4580b8 to your computer and use it in GitHub Desktop.
Ejemplo de uso de pgsql y pdo_pgsql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Módulo pgsql: | |
<?php | |
$c_pgsql = pg_connect("host=127.0.0.1 user=alu12345 password=12345 dbname=bd12345 port=1111"); | |
$r_pgsql = pg_query($c_pgsql, "select version()"); | |
$r = pg_fetch_assoc($r_pgsql); | |
echo $r['version']; | |
?> | |
// Módulo pdo_pgsql: | |
<?php | |
$c_pdo = new PDO("pgsql:host=127.0.0.1 user=alu12345 password=12345 dbname=bd12345 port=1111"); | |
$r_pdo = $c_pdo->query("select version()"); | |
$r = $r_pdo->fetch(PDO::FETCH_ASSOC); | |
echo $r['version']; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment