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,028

HOME > PHP > PHP Forum > มีปัญหาเกี่ยวกับการแสดงข้อมูลเฉพาะที่น้อยกว่าหรือเท่ากับ



 

มีปัญหาเกี่ยวกับการแสดงข้อมูลเฉพาะที่น้อยกว่าหรือเท่ากับ

 



Topic : 075543



โพสกระทู้ ( 18 )
บทความ ( 0 )



สถานะออฟไลน์
Twitter Facebook Hi5 Blogger



มีปัญหาเกี่ยวกับการแสดงข้อมูลเฉพาะที่น้อยกว่าหรือเท่ากับ คือ ต้องการเปรียบเทียบค่าน้อยกว่าหรือเท่ากับที่2คอลัมน์ในตารางเดียวกัน ถ้าจำนวนสินค้าในสต็อกมีจำนวนน้อยกว่าเท่ากับจุดที่กำหนดไว้ ให้แสดงข้อมูลออก แต่มันมีปัญหาที่ว่ามันแสดงออกมาไม่ตรงที่ต้องการ
สิ่งที่ต้องการคือ เมื่อจำนวนสินค้าน้อยกว่าเท่ากับจำนวนจุดต่ำสุดที่กำหนดไว้ก็แสดงออกมาเฉพาะที่น้อยกว่าเท่ากับจุดต่ำเท่านั้น ตัวอื่นที่ไม่เกี่ยวไม่เอา
คอลัมน์ที่เอามาเปรียบเทียบคือ amount=จำนวนสินค้าที่มีในสต็อก miny=จำนวนที่จุดต่ำสุด ในตารางproduct

Code (PHP)
<?
session_start();
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?

if ($sess_adminid<>session_id()) { 
    echo '<script language="javascript">'."\n";
    echo '<!--'."\n";
	echo "alert ('กรุณาลงชื่อเข้าใช้'); \n";
    echo "window.location='index.php'";
    echo '//-->'."\n";
    echo '</script>'."\n";
    exit ();
	} 
	?>
	
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ระบบหลังร้าน</title>
<style type="text/css">
<!--
body,td,th {
	color: #99FFCC;
}
.style15 {font-size: larger;
	color: #663333;
}
.style28 {font-family: Geneva, Arial, Helvetica, sans-serif; color: #FFFFFF; }
.style39 {font-family: Geneva, Arial, Helvetica, sans-serif}
.style20 {	font-family: Geneva, Arial, Helvetica, sans-serif;
	color: #000000;
}
.style59 {font-family: "MS Sans Serif", Tahoma, "Cordia New"}
.style41 {font-family: Geneva, Arial, Helvetica, sans-serif; color: #FFFFFF; font-weight: bold; }
.style41 {color: #FFFFFF}
.style64 {font-size: larger; color: #000000; }
.style65 {color: #000000; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; }
.style66 {font-weight: bold; font-family: Geneva, Arial, Helvetica, sans-serif;}
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #990066;
}
a:hover {
	text-decoration: none;
	color: #0000FF;
}
a:active {
	text-decoration: none;
}
.style72 {color: #000000; font-weight: bold; }
.style18 {	color: #663333;
	font-family: Geneva, Arial, Helvetica, sans-serif;
}
.style73 {color: #000000}
.style74 {font-size: 14px}
.style75 {font-weight: bold; font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 14px; }
.style77 {font-size: 16px; }
.style78 {color: #000000; font-family: Geneva, Arial, Helvetica, sans-serif; font-weight: bold; font-size: 16px; }
-->
</style>
</head>

<body>

<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="1022" height="161" valign="top"><div align="center"><img src="head/header.jpg" width="1000" height="220"></div></td>
  </tr>
</table>
<div align="center"></div>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="1000" height="800" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td width="1000" height="471" valign="top"><table width="999" border="0">
          <tr>
            <td width="269" valign="top" bgcolor="#FFFFCC"><table width="254" height="182" border="0" align="center">
              <tr>
                <td bgcolor="#FFFFCC"><table width="218" border="0" align="left" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="218" height="66" background="head/menu3_01.png">&nbsp;</td>
                  </tr>
                  <tr>
                    <td background="head/menu3_02.png"><table width="154" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                          <td><div align="center"><span class="style72">รายการ</span></div></td>
                        </tr>
                        <tr>
                          <td class="style65"><div align="left" class="style77">&nbsp;<img src="images/b-hana3-e.gif" width="13" height="14"><a href="admin.php" class="style74"> หน้าแรก </a></div></td>
                        </tr>
                        <tr>
                          <td><div align="left" class="style78">
                              <div align="left"><img src="images/b-hana3-e.gif" width="13" height="14"> <a href="admin_mem.php" class="style74">ลูกค้า </a></div>
                          </div></td>
                        </tr>
                        <tr>
                          <td><div align="left" class="style78">
                              <div align="left"><img src="images/b-hana3-e.gif" width="13" height="14">&nbsp;<a href="admin_product.php"><span class="style74">สินค้า</span><br>
                                </a><img src="images/b-hana3-e.gif" width="13" height="14"><a href="add_product.php" class="style74"> เพิ่มสินค้า</a><br>
                                <img src="images/b-hana3-e.gif" width="13" height="14"><a href="seach_ordist.php" class="style74"> เพิ่มจำนวนสินค้า</a><br>
                                <img src="images/b-hana3-e.gif" width="13" height="14"><a href="admin_productonhand.php" class="style74"> จำนวนสินค้าคงเหลือ </a><br>
                                <img src="images/b-hana3-e.gif" width="13" height="14">&nbsp;<span class="style75"><a href="admin_buy.php">สั่งซื้อ</a></span><br>
                              </div>
                          </div></td>
                        </tr>
                        <tr>
                          <td><div align="left" class="style78">
                              <div align="left"><img src="images/b-hana3-e.gif" width="13" height="14"> <a href="admin_dis.php" class="style74">ผู้จำหน่าย</a><br>
                                  <img src="images/b-hana3-e.gif" width="13" height="14"><a href="add_dis.php" class="style74"> เพิ่มผู้จำหน่าย</a><br>
                                &nbsp;<img src="images/b-hana3-e.gif" width="13" height="14"> <a href="admin_em.php" class="style74">พนักงาน </a><br>
                                <img src="images/b-hana3-e.gif" width="13" height="14"> <a href="add_em.php" class="style74">เพิ่มพนักงาน </a><br>
                                <img src="images/b-hana3-e.gif" width="13" height="14"> <span class="style74"><a href="forget_question.php">คำถามกันลืม</a></span><br>
                                <img src="images/b-hana3-e.gif" width="13" height="14"> <a href="forget_question_add.php" class="style74">เพิ่มคำถามกันลืม</a><br>
                              </div>
                          </div></td>
                        </tr>
                        <tr>
                          <td><div align="left" class="style78">
                              <div align="left"><img src="images/b-hana3-e.gif" width="13" height="14">&nbsp;<a href="admin_show_order.php" class="style74">รายการสั่งซื้อลูกค้า</a><br>
                                  <img src="images/b-hana3-e.gif" width="13" height="14"> <a href="admin_showorsdist.php" class="style74">รายการสั่งซื้อสินค้า</a></div>
                          </div></td>
                        </tr>
                        <tr>
                          <td height="76"><div align="left" class="style78">
                              <div align="left"><img src="images/b-hana3-e.gif" width="13" height="14"> <a href="admin_payment.php" class="style74">รายการโอนเงิน</a> <br>
                                  <img src="images/b-hana3-e.gif" width="13" height="14"> <a href="report.php" class="style74">รายงาน</a> <br>
                                  <strong><span class="style39"><span class="style66"><img src="images/b-hana3-e.gif" width="13" height="14"> <a href="logout.php" class="style74">ออกจากระบบ</a></span></span></strong><br>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
                          </div></td>
                        </tr>
                    </table></td>
                  </tr>
                  <tr>
                    <td height="35" background="head/menu3_03.png">&nbsp;</td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
           
            <td width="720" colspan="2" valign="top" bgcolor="#FFFFCC"><p align="center" class="style28"><span class="style20 style41">
            </span><span class="style20"> </span><span class="style20"> </span></p>
              <div align="center">
                  <p>
                    <?
	include"connect.php";
mysql_query("SET NAMES utf8") or die (mysql_error());

		$sql = "SELECT * FROM product where amount <= miny";
		$re=mysql_query($sql) or die (mysql_error());
		$Num_Rows = mysql_num_rows($re);
   
//ตรวจสอบว่ามีรายการที่เลือกไว้หรือป่าว	
	if ($Num_Rows   == 0) {
	echo "<br/><center><b style=color:red>ไม่มีสินค้าที่สั่งซื้อ</center></b>";
	echo "<meta http-equiv='refresh' content='2;url=admin_product.php'>";
	} 
	    
		$Per_Page = 4;   // Per Page

		$Page = $_GET["Page"];
		if(!$_GET["Page"])
		{
			$Page=1;
		}

		$Prev_Page = $Page-1;
		$Next_Page = $Page+1;

		$Page_Start = (($Per_Page*$Page)-$Per_Page);
		if($Num_Rows<=$Per_Page)
		{
			$Num_Pages =1;
		}
		else if(($Num_Rows % $Per_Page)==0)
		{
			$Num_Pages =($Num_Rows/$Per_Page) ;
		}
		else
		{
			$Num_Pages =($Num_Rows/$Per_Page)+1;
			$Num_Pages = (int)$Num_Pages;
		}

		$sql .=" order  by id ASC LIMIT $Page_Start , $Per_Page";
		$re=mysql_query($sql) or die (mysql_error());


		echo"<table border=\"0\"  cellspacing=\"1\" cellpadding=\"1\"><tr>";
		$intRows = 0;
		while($rs = mysql_fetch_array($re))
		{
			echo "<td>"; 
			$intRows++;
	?>
          
                    </span>                  </p>
                  <p>&nbsp;</p>
                  
                  <div align="center" class="style42">
                      <p align="center"><a href="admin_detail.php?id=<?=$rs["id"]?>"><img src="<?=$rs["picture"]?>" border="0"/><br>
                        <br> </a>                        </div>
                       <p align="center"><span class="style73">รหัส<?=$rs["id"];?>
                      </span>
                       <p align="center"> <span class="style73"><?=$rs["name_pr"];?>
                        </span>
                       <p align="center"><span class="style73">
                      ราคา 
                       <?=$rs["price2"];?> บาท
                      </span>
                       <p align="center"><span class="style73">         
                        สินค้าที่มี     
                        <?=$rs["amount"] ;?> 
					  
                      ตัว</span>                      
                      <p align="center"><span class="style73">                        <a href="admin_detail.php?id=<?=$rs["id"]?>"></br>
&nbsp;[สั่งซื้อ] </a> </span>
                        
             
                        
                        
                        
                        <?
			echo"</td>";
			if(($intRows)%2==0)
			{
				echo"</tr>";
			}
		}
		echo"</tr></table>";
	?>
                      <p align="center"><br>
                        <span class="style73">ทั้งหมด
                        <?= $Num_Rows;?>
                        รายการ :
                        <?=$Num_Pages;?>
                        หน้า :
                        <?
		if($Prev_Page)
		{
			echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< ก่อนหน้า</a> ";
		}

		for($i=1; $i<=$Num_Pages; $i++){
			if($i != $Page)
			{
				echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
			}
			else
			{
				echo "<b> $i </b>";
			}
		}
		if($Page!=$Num_Pages)
		{
			echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>ถัดไป>></a> ";
		}
		?>
                        </span> 
                        </span>                  </div>
                <p align="center" class="style20">&nbsp;</p>
                <p align="center" class="style18"></p>
                <h2 class="style15 style20 style59">&nbsp;                  </h2>
                </div>
             
          <tr bgcolor="#66CCFF">
            <td colspan="3" bgcolor="#CC9966"><div align="center">
              <p class="style64"><br>
                RUNGARUN PANSEESUK</p>
              <p class="style64">&nbsp;</p>
            </div></td>
            </tr>
        </table>
้</td>
  </tr>
    </table></td>
  </tr>
</table></body>
</html>





Tag : PHP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-03-14 20:29:20 By : friend View : 874 Reply : 1
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ลองใช้ BETWEEN ครับ

Go to : SQL BETWEEN






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-03-15 06:36:44 By : webmaster
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : มีปัญหาเกี่ยวกับการแสดงข้อมูลเฉพาะที่น้อยกว่าหรือเท่ากับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 03
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 อัตราราคา คลิกที่นี่