![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 10 Pomógł: 0 Dołączył: 28.09.2013 Ostrzeżenie: (0%) ![]() ![]() |
Witajcie
Czy ktoś może pomóc jak zrobić tak aby można było pobierać dane w ten sposów Kod $user = $DB->select('users', array('username','=','tomek')) or die(mysql_error()); przy kodzie ponieżej,Kod class DB { private $_pdo, $_query, $_error = false, $_results, $_count = 0; public static function getInstance() { if(!isset(self::$_instance)) { self::$_instance = new DB(); } return self::$_instance; } public function action($action, $table, $where = array()) { if (count($where) == 3) { $operators = array('=','>','<','>=','<=',); $field = $where[0]; $operator = $where[1]; $value = $where[2]; if (in_array($operator, $operators)){ $sql = "{$action} FROM {$table} WHERE {$field} {$operator} ?"; } } return false; } public function get($table, $where){ return $this->action('SELECT *', $table, $where); } ///////////, a nie tak $user = DB::getInstance()->select('username', array('username','=','tomek')); bez tego db::getInstance dzięki Ten post edytował login800 7.01.2015, 00:44:16 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 23.08.2025 - 18:46 |