- 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
<?php
class db {
function db_conn ($host,$user,$pass,$db) {
if((!$this->link = @mysqli_connect($host,$user,$pass)))
{
echo "<font color=\"red\">Error:</font> connect to host: $host";
exit();
}
if(!mysqli_select_db($this->link,$db))
{
echo "<font color=\"red\">Error:</font> select database $db";
exit();
}
}
function sql_query ($query) {
$this->link = mysqli_query($this->link, $query);
if (!$this->link)
{
$this->error_msg = mysqli_error ($this->link);
return $this->error_msg;
}
return $this->link;
}
function sql_fetch_assoc ($query) {
$res=$this->sql_query($query);
$array = array();
$row = mysqli_fetch_array($res);
/*{
$array[]=$cur;
}*/
mysqli_free_result($res);
return $row;
}
}
?>
neTyx_npoTKHyTbIu 25.08.2021 08:19 # 0