File: /home/cafsindia/medlocqr_com/admin/app/api_model.php
<?php
include('./dbconnect.php');
//error_reporting(0);
class api_model extends dbconnect{
public function __construct() {
$this->open_db();
}
public function get_data($mysql_qry){
$mysql_info = $this->runQuery("$mysql_qry");
$mysql_result = $this->result($mysql_info);
return $mysql_result;
}
public function QRCODE($size = 400, $filename = null,$data,$url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "chs={$size}x{$size}&cht=qr&chl=" . urlencode($data)."&choe=UTF-8");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
$img = curl_exec($ch);
curl_close($ch);
if ($img) {
if ($filename) {
if (!preg_match("#\.png$#i", $filename)) {
$filename .= ".png";
}
$ss = file_put_contents($filename, $img);
if($ss){
return $filename;
}
} else {
header("Content-type: image/png");
print $img;
return true;
}
}
return false;
}
public function get_state_data($mysql_state_qry){
$mysql_state_info = $this->runQuery("$mysql_state_qry");
$mysql_state_result = $this->result($mysql_state_info);
return $mysql_state_result;
}
public function get_city_data($mysql_city_qry){
$mysql_city_info = $this->runQuery("$mysql_city_qry");
$mysql_city_result = $this->result($mysql_city_info);
return $mysql_city_result;
}
public function get_blood_group_data($mysql_blood_group_qry){
$mysql_blood_group_info = $this->runQuery("$mysql_blood_group_qry");
$mysql_blood_group_result = $this->result($mysql_blood_group_info);
return $mysql_blood_group_result;
}
public function get_country_data($mysql_country_qry){
$mysql_country_info = $this->runQuery("$mysql_country_qry");
$mysql_country_result = $this->result($mysql_country_info);
return $mysql_country_result;
}
public function get_material_type_data($mysql_material_type_qry){
$mysql_material_type_info = $this->runQuery("$mysql_material_type_qry");
$mysql_material_type_result = $this->result($mysql_material_type_info);
return $mysql_material_type_result;
}
public function get_gender_data($mysql_gender_qry){
$mysql_gender_info = $this->runQuery("$mysql_gender_qry");
$mysql_gender_result = $this->result($mysql_gender_info);
return $mysql_gender_result;
}
public function select_data($mysql_select_qry){
$mysql_select_info = $this->runQuery("$mysql_select_qry");
$mysql_select_result = $this->result($mysql_select_info);
return $mysql_select_result;
}
public function insert_data($mysql_insert_qry){
$mysql_insert_info = $this->runQuery_insert_id("$mysql_insert_qry");
return $mysql_insert_info;
}
}
?>