php Ãʺ¸ÀÚÀÔ´Ï´Ù...
mysql¿¡´Â Á¤»óÀûÀ¸·Î ¿¬°áÇߴµ¥ À¥¿¡¼ °á°ú°ªÀÌ ¾Æ¹«°Íµµ ¾È³ª¿É´Ï´Ù.
¹è¿¿¡¼ ¹®Á¦°¡ »ý±ä°Å °°Àºµ¥ ÇØ°áÀ» ¸øÇÏ°í ÀÖ½À´Ï´Ù.
Ʋ¸°ºÎºÐÀÌ ÀÖ´Ù¸é ÀÚ¼¼ÇÏ°Ô ¼³¸íÀ» ÇØÁÖ½Ã¸é °¨»çÇÏ°Ú½À´Ï´Ù.
dbconnºÎºÐ
¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ
<?php
$db_host='127.0.0.1';
$db_user='root';
$db_pw ='qwe123';
$db_name='alram';
$dbconn = mysqli_connect ( $db_host, $db_user, $db_pw, $db_name) or die ( "MySQL¿¡ Á¢¼ÓÇÒ ¼ö ¾ø½À´Ï´Ù." );
mysqli_select_db ( $dbconn, $db_name ) or die ( "DB¿¡ ¿¬°áÇÒ ¼ö ¾ø½À´Ï´Ù." );
set_time_limit ( 0 );
?>
¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ¤Ñ
¸ÞÀÎphp ºÎºÐ
<?php
include_once "dbconn.inc";
if(isset($_GET['action'])) // °ªx
if(isset($_GET['_id']))
if(isset($_GET['br_broadcast']))
if(isset($_GET['br_category']))
if(isset($_GET['br_alarm']))
if(isset($_GET['br_alarm_time']))
if($action == "get_broadcast_list") {
//¹æ¼Û»ç,À帣¿¡ ¸Â´Â ¹æ¼Û ¸ñ·ÏÀ» °¡Á®¿Â´Ù.
$_sql = "SELECT * FROM br_broadcast_info_table WHERE br_broadcaster='$br_broadcaster' AND br_category='$br_category'";
/*$result = mysql_query($_sql, $dbconn);*/
$result = mysql_query("SELECT * from alram");
if(!$result){
die(mysql_error());
}
$resultJsonArr = array();
for($i = 1; $i = mysql_fetch_array($result); $i ++) {
$_resultJsonArr [i] = $list[_id];
$_resultJsonArr [i] = $list[br_name];
$_resultJsonArr [i] = $list[br_broadcaster];
$_resultJsonArr [i] = $list[br_category];
$_resultJsonArr [i] = $list[br_start_time];
$_resultJsonArr [i] = $list[br_day];
$_resultJsonArr [i] = $list[br_info];
$_resultJsonArr [i] = $list[br_alarm];
$_resultJsonArr [i] = $list[br_alarm_time];
array_push( $resultJsonArr, $_resultJsonArr );
}
$resultJsonArr[] = $_resultJsonArr;
echo json_encode($resultJsonArr);
}
else if($action == "update_br_alarm") {
//¾Ë¶÷Á¤º¸¸¦ ¾÷µ¥ÀÌÆ®ÇÑ´Ù.
$_sql = "UPDATE br_broadcast_info_table SET br_alarm=$br_alarm, br_alarm_time=$br_alarm_time WHERE _id=$_id";
$result = mysql_query($_sql, $dbconn);
if(!$result){
die(mysql_error());
}
}else if($action == "get_broadcast_alarm_time") {
//¾Ë¶÷ ¼³Á¤ ½Ã°£À» °¡Á®¿Â´Ù. (¸îºÐÀüÀÎÁö)
$_sql = "SELECT br_alarm_time FROM br_broadcast_info_table WHERE _id=$_id";
$result = mysql_query($_sql, $dbconn);
if(!$result){
die(mysql_error());
}else {
$list = mysql_fetch_array ( $result );
$_alarm_time = $list [br_alarm_time];
echo $_alarm_time;
}
}
mysqli_close($dbconn);
?>