delete uses postgres

master
Matt Huntington 8 years ago
parent 1cad051928
commit 9895e13f1c

@ -0,0 +1 @@
DELETE FROM people WHERE id = $1

@ -29,16 +29,11 @@ class People {
return self::find(); return self::find();
} }
static function delete($index){ static function delete($id){
$people = array(); $query = file_get_contents(__DIR__ . '/../database/sql/delete.sql');
$people[] = new Person('joni', 52); $result = pg_query_params($query, array($id));
$people[] = new Person('bob', 34);
$people[] = new Person('sally', 21);
$people[] = new Person('matt', 37);
array_splice($people, $index, 1);
return $people; return self::find();
} }
static function update($index, $updatedPerson){ static function update($index, $updatedPerson){
$people = array(); $people = array();

Loading…
Cancel
Save