|  |  | 
          
            | อันนี้ Page ส่งค่าครับชื่อ page_product.php 
 <?
$cid = odbc_connect($connection_string,$user, $pass) or die ("?เชื่อม?ต่อ server ไม่?ได้?");
$objResult = $_REQUEST['$objResult'];
$strSQL = "SELECT * FROM InventoryClass
		   		WHERE iInvCGrade = '2'
				AND cInvCCode LIKE 'PM%'";
$objExec = odbc_exec($cid, $strSQL) or die ("Error Execute [".$strSQL."]");
$objResult = odbc_fetch_array($objExec);
		while($objResult = odbc_fetch_array($objExec))
		{
		?>
<ul>
<li class="time_toon_font_p"><a href="page_subproduct.php?page=subproduct"><?=$objResult["cInvCName"];?></a> </li>
<?
}
odbc_close($cid);
?>
อันนี้ Page รับค่าครับชื่อ page_subproduct.php
 
 <?
	   $cid = odbc_connect($connection_string,$user, $pass) or die ("?เชื่อม?ต่อ server ไม่?ได้?");
    $strSQL2 = "SELECT * FROM pd_inv a
					  Right JOIN pd_img b
 		  			  ON a.pd_cod = b.pd_cod
					  WHERE a.pd_cod LIKE '$id[cInvCCode]%'";
    $objExec2 = odbc_exec($cid, $strSQL2) or die ("Error Execute [".$strSQL2."]");
    while($result = odbc_fetch_array($objExec2))
	{
?>
<h3 class="time_toon_font_h"><?=$result["pd_nambill"];?></h1>
<?
}
odbc_close($cid);
?>
<!--------------------------------------------->
 ต้องการเรียกดูสินค้าหมวด = แปรงลวด
 ผลที่ได้จาก Code ด้านบน
 1.ใบเจียร
 2.ตู้เชื่อม
 3.แปรงลวด
 <!--------------------------------------------->
 ตรง Link ที่ทำมันก็ส่งค่า ออกมาตามที่ต้องการนะครับ แต่ว่าหน้ารับ page_subproduct.php มันกลับแสดง pd_nambill มั่วนะครับ
 แต่ถ้า ผมนำทั้งสอง ส่วนรวมไว้ในเพจเดียวกัน มันกับแสดง pd_nambill ตามที่เราต้องการนะครับ
 
 เพจที่เรียก $strSQL ในเพจเดียวกัน
 
 <?php
$servername = "TOON"; //?ชื่อ? server
$databasename = "inv"; //?ชื่อ? database ?บน? MsSQL
$user = "sa"; //?username ?ที่?จะ? connect database
$pass = "252725272527"; //?password ?ที่?จะ? connect ?ไปที่? database
$connection_string ="DRIVER={SQL Server};SERVER=$servername;DATABASE=$databasename;AutoTranslate=no"; //?connect แบบ ODBC
$cid = odbc_connect($connection_string,$user, $pass) or die ("?เชื่อม?ต่อ server ไม่?ได้?");
$id = $_REQUEST['id'];
$strSQL = "SELECT * FROM InventoryClass
		   		WHERE iInvCGrade = '2'
				AND cInvCCode LIKE 'PM%'";
$objExec = odbc_exec($cid, $strSQL) or die ("Error Execute [".$strSQL."]");
$objResult = odbc_fetch_array($objExec);
		while($objResult = odbc_fetch_array($objExec))
		{
		?>
	<h3><a href="#"><?=$objResult["cInvCName"];?></a></h3>
	<div>
    <?
                    $strSQL2 = "SELECT * FROM pd_inv a
									  Right JOIN pd_img b
 		  							  ON a.pd_cod = b.pd_cod
									  WHERE a.pd_cod LIKE '$objResult[cInvCCode]%'";
                    $objExec2 = odbc_exec($cid, $strSQL2) or die ("Error Execute [".$strSQL2."]");
							while($result = odbc_fetch_array($objExec2))
							
							{
							?>
	
		<ul>
			<li><a href="inventory.php?id=<?=$objResult["pd_cod"];?>"class="img"rel="img/product/<? echo $result["pic_front"];?>"><?=$result["pd_nambill"];?></a></li>
            
		</ul>
      
	<?
		}
		?>
                </div>
		<?
		}
		?>
      
</div>
</div>
<!-- End demo -->
</body>
  <?
odbc_close($cid);
?>
<!--------------------------------------------->
 ต้องการเรียกดูสินค้าหมวด = แปรงลวด
 ผลที่ได้จาก Code ด้านบน
 1.แปรงลวดกลม
 2.แปรงลวดแบบมีด้าม
 3.แปรงลวดเกลียว
 <!--------------------------------------------->
 พี่ๆช่วยทีครับ
        
 
 
 Tag : PHP, Ms SQL Server 2008
 
 
 |  
            |  |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2012-01-12 10:09:34 | By :
                          time.toon | View :
                          1175 | Reply :
                          2 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |