- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
<?php
class db {
public $link;
public function __construct($host, $user, $password, $dbName) {
$this->link = @mysqli_connect($host, $user, $password, $dbName) or die('Access Denied2');
@mysqli_query($this->link, "SET NAMES utf8");
}
public function query($query = null) {
return @mysqli_query($this->link, $query);
}
public function escape($query = null) {
return @mysqli_real_escape_string($this->link, $query);
}
public function num($query = null) {
return @mysqli_num_rows($query);
}
public function fetch($query = null) {
return @mysqli_fetch_array($query);
}
public function assoc($query = null) {
return @mysqli_fetch_assoc($query);
}
public function insert_id() {
return @mysqli_insert_id($this->link);
}
public function error() {
return @mysqli_error($this->link);
}
public function __destruct() {
mysqli_close($this->link);
}
}
$db = new db('host','user','password','dbname');
error_reporting(0);
?>
barop 04.11.2016 17:04 # −63
bormand 04.11.2016 17:53 # 0
1024-- 04.11.2016 17:56 # 0
barop 04.11.2016 18:12 # −63
Soul_re@ver 04.11.2016 18:18 # 0
Если код работает, двойку за него ставить нельзя.
Gay 04.11.2016 19:54 # 0