Skip to content

Commit

Permalink
single.delete example added
Browse files Browse the repository at this point in the history
  • Loading branch information
irvingleonard committed Jun 4, 2014
0 parents commit 66e52be
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/single.delete/database-mysql_v5.x.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CREATE TABLE student (
id_student INT(11) KEY AUTO_INCREMENT,
identification_number VARCHAR(11) NOT NULL,
name varchar(50) NOT NULL,
age INT(2) NULL,
preferences TEXT
)
8 changes: 8 additions & 0 deletions examples/single.delete/student.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
class student extends ODBObject{
public $identification_number;
public $name;
public $age;
public $preferences;
}
?>
14 changes: 14 additions & 0 deletions examples/single.delete/test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
require_once "../objectDB/objectDB-mysql-v3.0.php"; // this will include first
require_once "student.php";

// load all students in database
$db = new objectDB();
$students_list = $db->getObjs('student');

// remove first student
$students_list[0]->remove();

// remove second student
$db->removeObj($students_list[1]);
?>

0 comments on commit 66e52be

Please sign in to comment.