Changeset 3 for database.php


Ignore:
Timestamp:
Oct 13, 2007, 5:41:26 PM (17 years ago)
Author:
george
Message:

Přepracováno: Nově použití objektové třídy mysqli pro přístup k mysql databázi.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • database.php

    r1 r3  
    1010  function select($Table, $What = '*', $Condition = 1)
    1111  {
    12     return($this->query("SELECT ".$What." FROM ".$this->Prefix.$Table." WHERE ".$Condition)); 
     12    $Query = "SELECT ".$What." FROM `".$this->Prefix.$Table."` WHERE ".$Condition;
     13    return($this->query($Query)); 
    1314  }
    1415
    1516  function delete($Table, $Condition)
    1617  {
    17     $this->query("DELETE FROM ".$this->Prefix.$Table." WHERE ".$Condition); 
     18    $this->query("DELETE FROM `".$this->Prefix.$Table."` WHERE ".$Condition); 
    1819  }
    1920 
     
    3132    $Name = substr($Name, 1);
    3233    $Values = substr($Values, 1);
    33     $this->query('INSERT INTO '.$this->Prefix.$Table-' ('.$Name.') VALUES('.$Values.')'); 
     34    $this->query('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')'); 
     35    //echo('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')');
    3436  }
    3537 
    3638  function update($Table, $Condition, $Data)
    3739  {
     40    $Values = '';
    3841    foreach($Data as $Key => $Value)
    3942    {
     
    4346    }
    4447    $Values = substr($Values, 2); 
    45     $this->query('UPDATE '.$this->Prefix.$Table.' SET '.$Values.' WHERE ('.$Condition.')');
     48    $this->query('UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')');
    4649  }
    4750 
     
    5962    $Name = substr($Name, 1);
    6063    $Values = substr($Values, 1);
    61     $this->query('REPLACE INTO '.$this->Prefix.$Table.' ('.$Name.') VALUES('.$values.')');
     64    $this->query('REPLACE INTO `'.$this->Prefix.$Table.'` (`'.$Name.'`) VALUES('.$values.')');
    6265  }
    6366 
Note: See TracChangeset for help on using the changeset viewer.