diff --git a/database/sql/create.sql b/database/sql/create.sql new file mode 100644 index 0000000..e69de29 diff --git a/models/person.php b/models/person.php index 68cf8f6..8357769 100644 --- a/models/person.php +++ b/models/person.php @@ -2,9 +2,11 @@ include_once __DIR__ . '/../database/db.php'; class Person { + public $id; public $name; public $age; - public function __construct($name, $age) { + public function __construct($id, $name, $age) { + $this->id = $id; $this->name = $name; $this->age = $age; } @@ -16,7 +18,7 @@ class People { $result = pg_query($query); $people = array(); while($data = pg_fetch_object($result)){ - $people[] = new Person($data->name, intval($data->age)); + $people[] = new Person(intval($data->id), $data->name, intval($data->age)); } return $people;