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 > ช่วยเขียน code เวลาคลิ๊ก ที่ภาพแล้วแสดงรายละเอียดของสินค้าหน่อยครับ



 

ช่วยเขียน code เวลาคลิ๊ก ที่ภาพแล้วแสดงรายละเอียดของสินค้าหน่อยครับ

 



Topic : 117810



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



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




อยากให้คลิ๊กที่ภาพแล้วแสดงรายละเอียดสินค้าชนิดเดีย

Code (PHP)
<?
	$objConnect = mysql_connect("localhost","root","abcd1234") or die("Error Connect to Database");
	mysql_query("SET NAMES UTF8");
	$objDB = mysql_select_db("thaimee");
	$strSQL = "SELECT * FROM product";
	$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
	$Num_Rows = mysql_num_rows($objQuery);
	
	
$Per_Page = 5;   // 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;
}

$strSQL .=" order  by FilesID ASC LIMIT $Page_Start , $Per_Page";
$objQuery  = mysql_query($strSQL);
 	

?>
</p>
<table width="200" border="0" align="center">
  <tr>
    <td><img src="picture/logo.png" width="150" height="100"></td>
  </tr>
</table>
<tr>
<table width="200" border="0" align="right">
    <tr>
      <td><form name="form1" method="post" action="search_product.php">
        <input type="submit" name="button" id="button" value="search">
      </form></td>
    </tr>
  </table>
  <tr>  </tr>
<table width="200" border="0">
    <tr>
      <th scope="row"><form id="form2" name="form2" method="post" action="product_thaistyle.php">
        <input type="submit" name="button2" id="button2" value="ThaiStyle" />
      </form></th>
    </tr>
  </table>
  <table width="200" border="0">
    <tr>
      <th scope="row"><form id="form3" name="form3" method="post" action="product_Processed.php">
        <input type="submit" name="button3" id="button3" value="Processed Fruit" />
      </form></th>
    </tr>
  </table>
  <table width="200" border="0">
    <tr>
      <th scope="row"><form id="form4" name="form4" method="post" action="product_candy.php">
        <input type="submit" name="button4" id="button4" value="Candy" />
      </form></th>
    </tr>
  </table>
        
       
  
  
  </form>
  <form id="form5" name="form5" method="post" action="">
  </form>
</tr>
<tr>
    <td>&nbsp;</td>
  </tr>
<table width="1416" height="75" border="1">
  <tr>
<th width="85" height="31"> <div align="center">ProductID </div></th>
<th width="212"> <div align="center">Productname</div></th>
<th width="229"> <div align="center">Product description</div></th>
<th width="155"> <div align="center">Product thaimee</div></th>
<th width="191"> <div align="center">Product Picture</div></th>
<th width="96"> <div align="center">Shelf Life</div></th>
<th width="96"> <div align="center">Availble flavor</div></th>


</tr>
<?

	while($objResult = mysql_fetch_array($objQuery))
	{
		
?>
<tr>
<td height="36"><div align="center"><?=$objResult["FilesID"];?></div></td>
<td><center><?php echo $objResult["Productname"];?></center></td>
<td><center><?php echo $objResult["Product description"];?></center></td>
<td><center><?php echo $objResult["Product thaimee"];?></center></td>
<td><center>
<a href="product packing.php"><img src="ViewImage_product.php?FilesID=<?=$objResult["FilesID"];?>"></a>
</center></td>
<td><center><?php echo $objResult["Shelf Life"];?></center></td>
<td><center><?php echo $objResult["Availble flavor"];?></center></td>
<?php

}
?>
</table>

<br>
Total <?php echo $Num_Rows;?> Record : <?php echo $Num_Pages;?> Page :
<?php

if($Prev_Page)
{
	echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</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'>Next>></a> ";
}
 
mysql_close($objConnect);
?>
</body>
</html>
</body>
</html>


รายละเอียดของสินค้า

Code (PHP)
<?
	$objConnect = mysql_connect("localhost","root","abcd1234") or die("Error Connect to Database");
	$objDB = mysql_select_db("thaimee");
	$strSQL = "SELECT * FROM packing INNER JOIN product ON(packing.FilesID = product.FilesID)ORDER BY packing.FilesID DESC";
	
	$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>

</p>
<table width="200" border="0" align="center">
  <tr>
    <td><img src="picture/logo.png" width="150" height="100"></td>
  </tr>
</table>


  <table width="200" border="0" align="right">
    <tr>
      <td><form name="form1" method="post" action="search_seafood.php">
        <input type="submit" name="button" id="button" value="search">
      </form></td>
    </tr>
  </table>
 
  <table width="200" border="0">
    <tr>
      <th scope="row"><form id="form2" name="form2" method="post" action="product_candy.php">
        <input type="submit" name="button2" id="button2" value="Candy" />
      </form></th>
    </tr>
  </table>
  <table width="200" border="0">
    <tr>
      <th scope="row"><form id="form3" name="form3" method="post" action="product_snack.php">
        <input type="submit" name="button3" id="button3" value="Snack" />
      </form></th>
    </tr>
  </table>
  <table width="200" border="0">
    <tr>
      <th scope="row"><form id="form4" name="form4" method="post" action="product_seafood.php">
        <input type="submit" name="button4" id="button4" value="Seafood" />
      </form></th>
    </tr>
  </table>
        
  
  </form></td>
  </tr>
<tr>
    <td>&nbsp;</td>
  </tr>
<table width="1416" height="111" border="1">
  <tr>
<th width="84" height="31"> <div align="center">Productname</div></th>
<th width="226"> <div align="center">Packing</div></th>
<th width="226"> <div align="center">Price</div></th>
<th width="144"> <div align="center">Boxsize</div></th>

</tr>
<?
	while($objResult = mysql_fetch_array($objQuery))
	{
		
?>
<tr>
<td><Left><?php echo $objResult["Productname"];?></center></td>
<td><center><?php echo $objResult["Packing"];?></center></td>
<td><center><?php echo $objResult["price"];?></center></td>
<td><center><?php echo $objResult["Boxsize"];?></center></td>


</tr>
<?
	} 
?>
</table>
<?
mysql_close($objConnect);
?>

</body>
</html>


อยากให้เวลาเราคลิ๊กที่ภาพแล้วแสดงแค่ชนิดสินค้าที่เราต้องการแค่ชนิดเดียว ที่ผมทำตอนนี้มันแสดงมาหมดเลย



Tag : PHP, MySQL, HTML/CSS









ประวัติการแก้ไข
2015-07-15 13:44:49
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2015-07-15 13:43:10 By : athiwatbuun View : 1413 Reply : 3
 

 

No. 1



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

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

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

Quote:
$objConnect = mysql_connect("localhost","root","abcd1234") or die("Error Connect to Database");
$objDB = mysql_select_db("thaimee");
$strSQL = "SELECT * FROM packing INNER JOIN product ON(packing.FilesID = product.FilesID)ORDER BY packing.FilesID DESC";


เพิ่ม WHERE ตัว ID เข้าไปด้วยครับ

หลักการเดียวกับตัวนี้ครับ

Code (PHP)
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM customer WHERE CustomerID = '".$_GET["CusID"]."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);


PHP MySQL Edit/Update Data Record







แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-07-15 16:12:25 By : mr.win
 


 

No. 2



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



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


ตอบความคิดเห็นที่ : 1 เขียนโดย : mr.win เมื่อวันที่ 2015-07-15 16:12:25
รายละเอียดของการตอบ ::

Code (PHP)
$strSQL = "SELECT * FROM packing WHERE  FilesID = '".$_GET["FilesID"]."' ";
	" INNER JOIN product ON(packing.FilesID = product.FilesID)ORDER BY packing.FilesID DESC";


code

พอใส่แล้วเป็นอย่างนี้อะครับ รบกวนช่วยทีนะครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-07-16 08:52:12 By : athiwatbuun
 

 

No. 3



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



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


ตอบความคิดเห็นที่ : 1 เขียนโดย : mr.win เมื่อวันที่ 2015-07-15 16:12:25
รายละเอียดของการตอบ ::
ผมทำได้แล้วครับ ขอบคุณมากนะครับ



ประวัติการแก้ไข
2015-07-16 10:28:51
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-07-16 10:28:30 By : athiwatbuun
 

   

ค้นหาข้อมูล


   
 

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