Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

dbobject in first working state -- basic functionality

  • Loading branch information...
commit 4a3c6ce9ee2b1538461286778606398b2848c609 1 parent bf8c5bc
Nikolai 'Noah' Banasihan authored

Showing 1 changed file with 12 additions and 3 deletions. Show diff stats Hide diff stats

  1. +12 3 dbobject.php
15 dbobject.php
@@ -68,7 +68,7 @@ public function insert($table_name, $values) {
68 68
69 69 }
70 70
71   - public function select($table_name, $col_array, $cond = null) {
  71 + public function select($table_name, $col_array, $cond = "") {
72 72 $cols = "";
73 73 foreach($col_array as $x) {
74 74 $cols .= $x . ",";
@@ -81,9 +81,12 @@ public function select($table_name, $col_array, $cond = null) {
81 81 $query .= ";";
82 82 echo $query;
83 83 echo "<br>";
  84 +
  85 + $result = $this->query($query);
  86 + return $result;
84 87 }
85 88
86   - public function update($table_name, $var_array, $cond) {
  89 + public function update($table_name, $var_array, $cond = "") {
87 90 $setvalues = "";
88 91 foreach($var_array as $x=>$y) {
89 92 $setvalues .= "$x" . "='".$y."' ";
@@ -95,9 +98,12 @@ public function update($table_name, $var_array, $cond) {
95 98 $query .= ";";
96 99 echo $query;
97 100 echo "<br>";
  101 +
  102 + $result = $this->query($query);
  103 + return $result;
98 104 }
99 105
100   - public function delete($table_name, $cond) {
  106 + public function delete($table_name, $cond = "") {
101 107 $query = "DELETE FROM " . $table_name;
102 108 if($cond != "") {
103 109 $query .= " WHERE " . $cond;
@@ -105,6 +111,9 @@ public function delete($table_name, $cond) {
105 111 $query .= ";";
106 112 echo $query;
107 113 echo "<br>";
  114 + $result = $this->query($query);
  115 + return $result;
  116 +
108 117 }
109 118 }
110 119

0 comments on commit 4a3c6ce

Please sign in to comment.
Something went wrong with that request. Please try again.