Permalink
Browse files

dbobject in first working state -- basic functionality

  • Loading branch information...
1 parent bf8c5bc commit 4a3c6ce9ee2b1538461286778606398b2848c609 @noahverus committed Aug 22, 2011
Showing with 12 additions and 3 deletions.
  1. +12 −3 dbobject.php
View
15 dbobject.php
@@ -68,7 +68,7 @@ public function insert($table_name, $values) {
}
- public function select($table_name, $col_array, $cond = null) {
+ public function select($table_name, $col_array, $cond = "") {
$cols = "";
foreach($col_array as $x) {
$cols .= $x . ",";
@@ -81,9 +81,12 @@ public function select($table_name, $col_array, $cond = null) {
$query .= ";";
echo $query;
echo "<br>";
+
+ $result = $this->query($query);
+ return $result;
}
- public function update($table_name, $var_array, $cond) {
+ public function update($table_name, $var_array, $cond = "") {
$setvalues = "";
foreach($var_array as $x=>$y) {
$setvalues .= "$x" . "='".$y."' ";
@@ -95,16 +98,22 @@ public function update($table_name, $var_array, $cond) {
$query .= ";";
echo $query;
echo "<br>";
+
+ $result = $this->query($query);
+ return $result;
}
- public function delete($table_name, $cond) {
+ public function delete($table_name, $cond = "") {
$query = "DELETE FROM " . $table_name;
if($cond != "") {
$query .= " WHERE " . $cond;
}
$query .= ";";
echo $query;
echo "<br>";
+ $result = $this->query($query);
+ return $result;
+
}
}

0 comments on commit 4a3c6ce

Please sign in to comment.