Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ไม่มีข้อมูลในฐานข้อมูลก็ไม่ต้องโชว์ Select Menu/List



 

ไม่มีข้อมูลในฐานข้อมูลก็ไม่ต้องโชว์ Select Menu/List

 



Topic : 105468

Guest




รูปตัวอย่าง

ถ้าไม่มีข้อมูลในฐานข้อมูลก็ไม่ต้องโชว์
ถ้าเราอยากให้มันแสดงแค่ 38 และ 39 ต้องทำยังไงครับ



Tag : PHP, CakePHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2014-02-05 02:38:23 By : นิวัฒน์ View : 774 Reply : 1
 

 

No. 1

Guest


Code (PHP)
<?php
session_start() ;
if (!isset($_SESSION['login_true'])) 
?>
<?
include "connect.php";
?>
<?
$id = $_GET["product_id"];
$sql = "select * from product where product_id = $id";
$ex = mysql_query($sql, $conn);
while ($rs=mysql_fetch_array($ex)) {
?>
<?
$product_id = $rs[product_id];
$code = sprintf("%05d", $product_id );
?>
<!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=windows-874" />
<title>Untitled Document</title>
<style type="text/css">
#body {
	background-image: url(images/templatemo_body.jpg);
	background-repeat: repeat;
	position: absolute;
	z-index: 1;
	width: 100%;
	left: 0px;
	top: 0px;
	height: 100%;
}
.manuproduct {
	width: 218px;
	float: left;
	margin-right: 20px;
	margin-top: 30px;
	margin-left: 35px;
	margin-bottom: 35px;
}
.product_box {
	float: left;
	width: 215px;
	margin-top: 0px;
	margin-right: 10px;
	margin-bottom: 10px;
	margin-left: 0px;
}
.top {
	background-image: url(images/templatemo_body_top.jpg);
	background-repeat: repeat;
	position: absolute;
	z-index: 1;
	width: 100%;
	left: 0px;
	top: 0px;
	height: 411px;
}
.manubar_b {
	width: 100%;
	position: absolute;
	top: 130px;
	z-index: 1;
	left: 0px;
}
.manu {
	height: 40px;
}
.body_product {
	width: 700px;
	margin-top: 30px;
	margin-bottom: 35px;
	margin-left: 0px;
	margin-right: 15px;
}
#body_product {
	width: 680px;
	float: right;
	margin-top: 30px;
	margin-right: 20px;
}
.manubar_bb {
	background-repeat: no-repeat;
	width: 980px;
	height: 60px;
	float: right;
	background-image: url(images/templatemo_menubar.png);
}
#apDiv1 {
	position: absolute;
	width: 200px;
	height: 115px;
	z-index: 2;
	left: 675px;
	top: -119px;
}
.login {
	width: 300px;
}
.formB {
	font-size: 16px;
	color: #333;
}
</style>
</head>

<body background="images/templatemo_body.jpg">
<table width="980%" border="0" cellpadding="0" cellspacing="0" id="body">
  <tr>
    <td id="body"><table width="980%" border="0" cellpadding="0" cellspacing="0" class="top">
      <tr>
        <td><table width="980" border="0" align="center" cellpadding="0" cellspacing="0" class="manubar_b">
          <tr>
            <td><table  background="images/templatemo_main_bg.png" width="980" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td><table width="980" border="0" cellpadding="0" cellspacing="0" class="manubar_bb">
                  <tr>
                    <td valign="top"><table   width="980" border="0" cellpadding="0" cellspacing="0" class="manu">
                      <tr>
                        <td><div class="manu_b">
                        <?
						{
							include ("menuber.php");
						}
						?>
                        </div></td>
                      </tr>
                    </table>
                      <div class="manuproduct">
                        <div>
                          <?
{
  include("manuproduct.php");
}
?>
                        </div>
                        <br />
                        <div>
                          <?
					  {
						  include "login2.php";
					  }
					  ?>
                        </div>
                        <br />
                        <br />
                      </div>
                      <div id="body_product">
                        <table width="500%" border="0" cellspacing="2" cellpadding="2">
                          <tr>
                            <td width="315"><img
src="admin/product/images/<?=$rs[product_image]?>" alt="" width="315" height="400" /></td>
                            <td valign="top" class="formB"><?=$rs[product_name]?>
                              <br />
                              [ <a href=basket_add.php?id=<?=$rs[product_id]?>>หยิบใส่ตะกร้า</a> ]
                              <br />
                              <select name="ptype" >
                                <option value=""> -- เลือกข้อมูลประเภทสินค้า -- </option>  
<option value="<?=$rs[size]?>"><?=$rs[size]?></option>
<option value="<?=$rs[size2]?>"><?=$rs[size2]?></option>
<option value="<?=$rs[size3]?>"><?=$rs[size3]?></option>
                                <?

mysql_close($conn);
?>
                              </select>
                              <br />
<br /></td>
                            </tr>
                          <tr>
                            <td>&nbsp;</td>
                            <td valign="top" class="formB">&nbsp;</td>
                          </tr>
                        </table>
                      </div></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <?
}
?>
  <div class="login">Content for  class "login" Goes Here</div>
</table>
</body>
</html>








แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-05 02:40:33 By : นิวัฒน์
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ไม่มีข้อมูลในฐานข้อมูลก็ไม่ต้องโชว์ Select Menu/List
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่