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 > ต้องการดึงข้อมูลจาก Database ขึ้นมาโชว์ครับรบกวนพี่ๆชี้แนะทีคับ



 

ต้องการดึงข้อมูลจาก Database ขึ้นมาโชว์ครับรบกวนพี่ๆชี้แนะทีคับ

 



Topic : 074121



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



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




Code (PHP)
<?
session_start();
if ($sess_adminid<>session_id()) { 
	header( "Location: admin_index.php"); exit(); 
}
include "connect.php";

?>
<!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=UTF-8" />
<title> Smile-IT สำหรับผู้ดูแลระบบ</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-image: url();
	background-repeat: no-repeat;
}
.style3 {color: #FFFFFF}
a:link {
	color: #0000FF;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #0000FF;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.style4 {color: #FF0000}
-->
</style>
<script src="../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<script language="javascript">
        
        function check(){
          if(document.form1.protype.value=="0"){
            alert("กรุณาเลือกประเภทสินค้าด้วยครับ");
            document.form1.protype.focus();
            return false;
          }
        
          else if(document.form1.orders_proid.value=="0"){
          alert("กรุณาเลือกชนิดสินค้า");
          document.form1.orders_proid.focus();
         
          return false;
          }
          
         else if(document.form1.seller.value=="0"){
         alert("กรุณาเลือกชื่อตัวแทนจำหน่่าย");
         document.form1.seller.focus();
         return false;
         }
          
         else if(document.form1.number.value==""){
         alert("กรุณากรอกจำนวนสินค้า");
           document.form1.number.focus();
         return false;
         }
        
         
        return true;
        }
		
		function checkNum(){
                if (event.keyCode < 48 || event.keyCode > 57){
                      event.returnValue = false;
                    }
            }
        
</script>
</head>

<body>
<form id="form1" name="form1" method="post" action="admin_orders_stock_save.php" onSubmit="return check()">
  <div align="center">
    <table width="1217" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td height="235" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="312" height="234" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <!--DWLayoutTable-->
              <tr>
                <td height="234" colspan="2" valign="top"><img src="image/logo_zz.jpg" width="347" height="234" /></td>
                  </tr>
              <tr>
                <td width="315" height="1"></td>
                    <td width="315"></td>
                  </tr>
              </table></td>
              <td width="769" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
                <!--DWLayoutTable-->
                <tr>
                  <td width="773" height="235" valign="top"><img src="image/bgweb2.jpg" width="903" height="234" /></td>
                  </tr>
              </table></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td height="30" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="311" height="30" valign="top" bgcolor="#000000"><!--DWLayoutEmptyCell-->&nbsp;
           
            </td>
            </tr>
        </table></td>
        <td colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="10" height="30" valign="middle" bgcolor="#000000"> <div align="right" class="style3">
              <td width="830" height="30" valign="middle" bgcolor="#000000"> <div align="right" class="style3">
              <div align="center"></div>
            </div></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td width="250" height="37">&nbsp;</td>
        <td colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="770" height="37" align="center" valign="middle"><div align="center">             </td>
          </tr>     
        </table></td>
        <td width="197" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="197" height="198" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
            </tr>
        </table></td>
      </tr>
      
      <tr>
        <td height="161">&nbsp;</td>
        <td colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="790" height="160" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
              <!--DWLayoutTable-->
              <tr>
                <td width="790" height="160" valign="top"><label></label>
                  <div align="center">
                    <p>
                      <?
include"connect.php";
$sql1="select * from order_stock.o,type.t 
       where o.Type_id=t.Type_id";
mysql_query("SET NAMES tis620");
$result1=mysql_query($dbname,$sql1) or die(mysql_error());    
while($row=mysql_fetch_array($result1)){   
print"<tr>";
print"<td align=center>$row[orders_stockid] </td>";
print"<td>$row[Type_id] </td>";
print"<td>$row[Pro_id] </td>";
print"<td>$row[orders_num] </td>";
print"</tr>";
}
?>
                    </p>
                    <p>&nbsp;
                    </p>
                    <p>&nbsp;  </p>
                  </div></td>
                </tr>
            </table></td>
          </tr>
          
        </table></td>
      </tr>
      <tr>
        <td height="337" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="1217" height="337" align="center" valign="top">&nbsp;</td>
            </tr>
          
          
        </table></td>
      </tr>
      <tr>
        <td height="47" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="1217" height="47" align="center" valign="top"><img src="image/logolow.jpg" width="934" height="47" /></td>
            </tr>
        </table></td>
      </tr>
      <tr>
        <td height="825">&nbsp;</td>
        <td width="127">&nbsp;</td>
        <td width="643">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
  </div>
</form>
</body>
</html>


ต้องการดึงข้อมูลขึ้นมาโชว์จากตาราง Orders_stock โดยที่ตาราง Orders_stock เก็บค่า Fk ของ ตาราง type แล้วอยากให้มันแสดงเป็นชื่อประเภทสินค้าต้องทำอย่างไรครับผม รบกวนพี่ๆช่วยทีครับ นั่งมั่วมา 3 วันแล้วครับผม

ไฟล์



Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-02-19 00:24:00 By : kakeruna View : 1000 Reply : 2
 

 

No. 1



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

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

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


ถ้า error แบบนั้นแสดงว่า database connection ผิดครับ หรือไม่ก็ยังไม่ได้ select database

แล้วทำไมต้อง include"connect.php"; สองรอบ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-02-19 06:25:30 By : ikikkok
 


 

No. 2



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



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


แก้แล้วยังเป็นเหมือนครับพี่
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-02-19 07:42:49 By : kakeruna
 

   

ค้นหาข้อมูล


   
 

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