# Query ช้อมูลในฐานข้อมูล
# $sql=$db->get_a_line("select * from user where user_id='1'");
public function get_a_line($mysql)
{
if(!($result = mysql_query ("$mysql"))){$men = mysql_errno();$mem = mysql_error();echo ("<h4>$mysql $men $mem</h4>");exit;}
$result=mysql_query($mysql);
$row=mysql_fetch_array($result);
mysql_free_result ($result);
return $row;
}
คำสั่งแสดงข้อมูล
include_once("lib/class_connect.php");
$obj_class=new connect_database();
//รูปแบบ ตัวแปร = $obj_class->get_a_line(“คาสั่ง SQL”);
$sql_g=$obj_class->get_a_line("SELECT * FROM user WHERE user_id= '1'");
echo $sql_g['username'];