| Server IP : 172.67.216.113 / Your IP : 104.23.243.33 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home2/cp648411/public_html/simded.com/class2/ |
Upload File : |
<?php
class Viewdata extends Connect
{
public function view($param)//$param = ตัวแปร array
{
$varibles = array_keys($param);
$table = @$param['table'];
$where = @$param['where'];
$order = @$param['order'];
$limit = @$param['limit'];
$count = @$param['count'];
$txt_where = "";
$txt_order = "";
$txt_limit = "";
$txt_count = "*";
if($where)
{
$txt_where = "WHERE " . $where;
}
if($order)
{
$txt_order = $order;
}
if($limit)
{
$txt_limit = "LIMIT ".$limit;
}
if($count)
{
$txt_count = $count;
}
$sql = "SELECT $txt_count FROM `$table` $txt_where $txt_order $txt_limit";
return $sql;
}
public function q($query)
{
$this->setconnect();
//$result = mysqli_query($query) or die('Query failed: ' . mysqli_error());or die (mysqli_error($this->setconnect())
$result = mysqli_query($this->setconnect(), $query);
@$row = mysqli_fetch_assoc($result);
return $row;
}
public function q_re($query)
{
$this->setconnect();
//$result = mysqli_query($this, $query) or die('Query failed: ' . mysqli_error());
$result = mysqli_query($this->setconnect(), $query);
return $result;
}
public function q_ro($result)
{
$row = mysqli_fetch_assoc($result);
return $row;
}
public function q_nr($result)
{
$row = mysqli_num_rows($result);
return $row;
}
}
?>