ขอถามเรื่องการทำ spry menu bar โดยดึงข้อมูลจาก Mysql

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

worrawooth
PHP Full Member
PHP Full Member
โพสต์: 48
ลงทะเบียนเมื่อ: 05/02/2009 5:06 pm

ขอถามเรื่องการทำ spry menu bar โดยดึงข้อมูลจาก Mysql

โพสต์ที่ยังไม่ได้อ่าน โดย worrawooth »

ขอถามเรื่องการทำ spry menu bar โดยดึงข้อมูลจาก Mysql
คือ ผมต้องการที่จะทำเมนูโดยทำการดึงข้อมูลมาจาก DB เพื่อเป็นหัวข้อของเมนูย่อย เช่น เดลินวส์ ประกอบด้วย การเมือง กีฬา อื่นๆๆ ไทยรัฐ ประกอบด้วยประเภทข่าว หลายๆๆ อย่าง เป็นต้น คือ ว่าแต่ละสำนักอาจมีประเภทข่าวที่ไม่เหมือนกัน ก็เลยทำการดึงข้อมูลจาก DB มมาทำเป็นเมนู

ฐานข้อมูลประกอบ ด้วย
1. สำนักข่าว เก็บสำนักข่าว
2. ตารางเก็บ URL ประเภทข่าว
3. ตารางเก็บประเภทของสำนักข่าวทุกสำนัก
ทั้ง 3 ตารางมีความสัมพันธ์กัน

สำนักข่าว 1 สำนัก มีหลายประเภทข่าว

ตัวอย่างนะครับ

เดลินิวส์
-การเมือง
-กีฬา
ไทยรัฐ
-อาชญกรรม

แบบนี้อะครับขอความช่วยเหลือด้วยครับ
phpmania
PHP Newbie
PHP Newbie
โพสต์: 8
ลงทะเบียนเมื่อ: 05/02/2009 11:19 pm

Re: ขอถามเรื่องการทำ spry menu bar โดยดึงข้อมูลจาก Mysql

โพสต์ที่ยังไม่ได้อ่าน โดย phpmania »

spry menu คืออะไร หว่า อยากรู้ด้วยคน
worrawooth
PHP Full Member
PHP Full Member
โพสต์: 48
ลงทะเบียนเมื่อ: 05/02/2009 5:06 pm

Re: ขอถามเรื่องการทำ spry menu bar โดยดึงข้อมูลจาก Mysql

โพสต์ที่ยังไม่ได้อ่าน โดย worrawooth »

ที่มีเครื่องมืออยู่ใน dw cs3 อะครับ
worrawooth
PHP Full Member
PHP Full Member
โพสต์: 48
ลงทะเบียนเมื่อ: 05/02/2009 5:06 pm

Re: ขอถามเรื่องการทำ spry menu bar โดยดึงข้อมูลจาก Mysql

โพสต์ที่ยังไม่ได้อ่าน โดย worrawooth »

ผู้รู้มาตอบที

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=tis620" />
<title>RSS NEWS by CPE12</title>
<script src="file:///C|/AppServ/www/propage/SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="file:///C|/AppServ/www/propage/SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
<script src="file:///C|/AppServ/www/propage/Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>

<body>
<table width="100%" border="0">
<tr>
<th colspan="3" scope="col">&nbsp;</th>
</tr>
<tr>
<td>&nbsp;</td>
<td valign="top"><form id="form1" name="form1" method="post" action="">
¤é¹ËÒ¢èÒÇ
<label>
<input type="text" name="textfield" id="textfield" />
</label>
<label>
<select name="select" id="select">
<option>¡ÒÃàÁ×ͧ</option>
<option>àÈÃÉ°¡Ô¨</option>
<option>µèÒ§»ÃÐà·È</option>
<option>ÍÒª­Ò¡ÃÃÁ</option>
<option>¡ÕÌÒ</option>
<option>ºÑ¹à·Ô§</option>
</select>
</label>
<label>
<select name="select2" id="select2">
<option>1 Çѹ</option>
<option>2 Çѹ</option>
<option>3 Çѹ</option>
<option>4 Çѹ</option>
<option>5 Çѹ</option>
<option>6 Çѹ</option>
<option>7 Çѹ</option>
</select>
</label>
</form> </td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="27%">

<ul id="MenuBar1" class="MenuBarVertical">

<?php

define("DB_SERVER", "127.0.0.1"); // database server
define("USERNAME", "root"); // username
define("PASSWORD", "1234"); // no password
define("CURRENT_DB", "dbrss"); // current database
$db = mysql_pconnect( DB_SERVER, USERNAME, PASSWORD);
mysql_query("SET NAMES TIS620");


$sql="SELECT r_name, r_url FROM t_residence";
$result_show = mysql_db_query(CURRENT_DB, $sql);

if($result_show) {
while($rows = mysql_fetch_array($result_show)){
$link_name = $rows['r_name'];
$link_url = $rows['r_url'];
echo "<li><a class=\"MenuBarItemSubmenu\"href=\"$link_url\">$link_name</a>";

echo "<ul>";

$sql_show="SELECT chanel_name, chanel_url FROM t_chanel WHERE r_id = '$result_show(r_id)'";
$result = mysql_db_query(CURRENT_DB, $sql_show);

if($result) {
while($rows1 = mysql_fetch_array($result)){
$link1_name = $rows1['chanel_name'];
$link1_url = $rows1['chanel_url'];
$link1_rid = $row1['r_id'];
echo "<li><a href=\"$link1_url\">$link1_name</a></li>";
}
}
echo "</ul>";
}
}

?>
</ul> </td>
<td width="66%" valign="top"><p>&nbsp;</p></td>
<td width="7%">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<script type="text/javascript">
<!--
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
//-->
</script>
</body>
</html>
worrawooth
PHP Full Member
PHP Full Member
โพสต์: 48
ลงทะเบียนเมื่อ: 05/02/2009 5:06 pm

Re: ขอถามเรื่องการทำ spry menu bar โดยดึงข้อมูลจาก Mysql

โพสต์ที่ยังไม่ได้อ่าน โดย worrawooth »

ดึงข้อมูลจากตาราง 3 ตาราง โดยให้แสดงเมนูแรกออกมาเป็นสำนักข่าวด้วยการดึงค่าจากตารางที่ 1 ย่อยลงไปในสำนักข่าวมีประเภทข่าวไหนบ้าง ต้องเขียน sql ในลักษณะไหนครับ
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 120