Changeset 50 for www/database.php
- Timestamp:
- Feb 24, 2008, 2:07:52 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
www/database.php
r30 r50 1 <? 1 <?php 2 2 3 3 // Extended database class … … 7 7 { 8 8 var $Prefix = ''; 9 var $LastQuery = ''; 9 10 10 11 function select($Table, $What = '*', $Condition = 1) 11 12 { 12 $ Query = "SELECT ".$What." FROM `".$this->Prefix.$Table."` WHERE ".$Condition;13 return($this->query($ Query));13 $this->LastQuery = "SELECT ".$What." FROM `".$this->Prefix.$Table."` WHERE ".$Condition; 14 return($this->query($this->LastQuery)); 14 15 } 15 16 16 17 function delete($Table, $Condition) 17 18 { 18 $this->query("DELETE FROM `".$this->Prefix.$Table."` WHERE ".$Condition); 19 $this->LastQuery = "DELETE FROM `".$this->Prefix.$Table."` WHERE ".$Condition; 20 $this->query($this->LastQuery); 19 21 } 20 22 … … 26 28 { 27 29 $Value = strtr($Value, '"', '\"'); 28 $Name .= ', '.$Key;30 $Name .= ',`'.$Key.'`'; 29 31 if($Value == 'NOW()') $Values .= ",".$Value; 30 32 else $Values .= ",'".$Value."'"; … … 32 34 $Name = substr($Name, 1); 33 35 $Values = substr($Values, 1); 34 $this->query('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')'); 36 $this->LastQuery = 'INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')'; 37 $this->query($this->LastQuery); 35 38 } 36 39 … … 45 48 } 46 49 $Values = substr($Values, 2); 47 $this->query('UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')'); 50 $this->LastQuery = 'UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')'; 51 $this->query($this->LastQuery); 48 52 } 49 53 … … 62 66 $Values = substr($Values, 1); 63 67 //echo('REPLACE INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES ('.$Values.')<br>'); 64 $this->query('REPLACE INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')'); 68 $this->LastQuery = 'REPLACE INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')'; 69 $this->query($this->LastQuery); 65 70 //echo($this->error().'<br>'); 66 71 } … … 68 73 function charset($Charset) 69 74 { 70 $this->query('SET CHARACTER SET '.$Charset); 75 $this->LastQuery = 'SET CHARACTER SET '.$Charset; 76 $this->query($this->LastQuery); 71 77 } 72 78
Note:
See TracChangeset
for help on using the changeset viewer.