|
 |
|
[PHP] สอบถามระบบ Notification โดยอ้างอิงจากฐานข้อมูล |
|
 |
|
|
 |
 |
|
จากบทความนั้น แนะนำให้ไปหาพวก jQuery ที่เป็น Dialog มาใช้ครับ แต่มันก็จะต้องเปิด Web Browser ถึงจะ Alert ครับ 
|
 |
 |
 |
 |
Date :
2015-01-28 15:31:56 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คือเวลา insert ถ้าเราไม่เปิดหน้าที่จะ alert มันก็ไม่ได้ใช่ไหมครับ
ถ้างั้น จากบทความของพี่ ผมจะทำแบบว่าพอล๊อกอินยูสเซอร์เข้าไป ถ้ามีข้อมูลที่ยังไม่ได้อ่านก็จะ alert หรือถ้าadmin เพิ่มข้อมูลใหม่ก็จะ alert
ขอคำแนะนำแนวทางหน่อยครับ 
|
 |
 |
 |
 |
Date :
2015-01-28 16:40:56 |
By :
muanpear |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พอดีผมลองทำแบบพื้นๆ
หน้าที่มี alert
Code (PHP)
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script>
$(function() {
$( "#dialog" ).dialog();
});
</script>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die(mysql_error());
$objDB = mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM message WHERE New = 'No' ORDER BY MessageID DESC";
$objQuery = mysql_query($strSQL) or die (mysql_error());
?>
<div id="dialog" title="Alert">
<?
while($obResult = mysql_fetch_array($objQuery)){
echo '<a href="testnoti2.php?id='.$obResult['MessageID'].'" target="_new">'.$obResult['MessageID'].'</a><br>';
}
?>
</div>
</body>
</html>
หน้าดูข้อมูล
Code (PHP)
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title></title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die(mysql_error());
$objDB = mysql_select_db("mydatabase");
$strSQL = " UPDATE message SET New = 'Yes' WHERE MessageID = ".$_GET['id']."";
$objQuery = mysql_query($strSQL) or die (mysql_error());
?>
<button onclick="opener.location=opener.location.toString();self.close();">Close</button>
</body>
</html>
ถ้าอยากพัฒนาเป็น ajax ทำแนวไหนดีครับ ขอบคุณครับ
|
 |
 |
 |
 |
Date :
2015-01-30 14:40:13 |
By :
muanpear |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|