find works with postgres

master
Matt Huntington 8 years ago
parent 91b1400030
commit 99ffdc74e7

@ -9,11 +9,12 @@ class Person {
} }
class People { class People {
static function find(){ static function find(){
$dbconn = pg_connect("host=localhost dbname=phpapi");
$result = pg_query('SELECT * FROM people');
$people = array(); $people = array();
$people[] = new Person('joni', 52); while($data = pg_fetch_object($result)){
$people[] = new Person('bob', 34); $people[] = new Person($data->name, intval($data->age));
$people[] = new Person('sally', 21); }
$people[] = new Person('matt', 37);
return $people; return $people;
} }

Loading…
Cancel
Save