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

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: ขอถามเรื่องการทำ spry menu bar โดยดึงข้อมูลจาก Mysql

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

โดย worrawooth » 06/02/2009 3:02 am

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

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

โดย worrawooth » 06/02/2009 2:29 am

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

<!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>

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

โดย worrawooth » 06/02/2009 12:56 am

ที่มีเครื่องมืออยู่ใน dw cs3 อะครับ

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

โดย phpmania » 05/02/2009 11:32 pm

spry menu คืออะไร หว่า อยากรู้ด้วยคน

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

โดย worrawooth » 05/02/2009 5:15 pm

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

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

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

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

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

แบบนี้อะครับขอความช่วยเหลือด้วยครับ

ข้างบน