2.4. Dasturiy taminotning strukturasi
Online Ambulance
Client-server prinspi
Foydalanuvchi tibbiyot haqidadagi bo’limlar orqali o’ziga kerakli
ma’lumotlarni ko’rishi, ular haqida ma’lumotlar olishi mumkin va saqlashi
mumkin.
SERVER
JSON
PHP kodi
SERVER
JSON
@mysql_connect("db.webspace.uz","khorezms_admin","khorezm1417")or
die("Severga bog`lanishda muammo ");
@mysql_select_db("khorezms_help")or die("Bazaga bog`lanishda xatolik");
$query="SELECT
`info`.info_id,`info_type`.info_type_name,`info`.info_image,`info`.info_add_ti
me,`info`.info_sarlavha,`info`.info_matn FROM `info_type`,`info` WHERE
`info`.info_type_id=`info_type`.info_type_id";
if(isset($_GET["type"]) && intval($_GET["type"])>0) {
$query .= " AND `info`.info_type_id=".$_GET["type"];
}
$result = mysql_query($query) or die('So`rovda xatolik: '.$query);
$response["info"] = array();
if(mysql_num_rows($result)) {
while($row = mysql_fetch_assoc($result)) {
$info = array();
$info["info_id"] = $row["info_id"];
$info["info_type_name"] = $row["info_type_name"];
$info["info_add_time"] = $row["info_add_time"];
$info["info_image"] = $row["info_image"];
$info["info_sarlavha"] = $row["info_sarlavha"];
$info["info_matn"] = $row["info_matn"];
array_push($response["info"], $info);
}
}
header('Content-type: application/json');
echo json_encode($response);
@mysql_close();
?>
Do'stlaringiz bilan baham: |