|
|
|
อยากให้เวลาคลิกแล้วชื่อสินค้าตามมาแสดงอีก หน้านึงด้วยครับ |
|
|
|
|
|
|
|
Code
<?php
$q = intval($_GET['q']);
$find = $_GET['find'];
$serverName = "localhost";
$userName = "root";
$userPassword = "abcd1234";
$dbName = "thaimee";
$con = mysqli_connect($serverName,$userName,$userPassword,$dbName);
mysqli_set_charset($con, "utf8");
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,"thaimee");
if($q!="") {
$fsql = " where CategoryID = '".$q."' ";
}
if($find!="") {
$fsql .= ($fsql!="")?" and ":" where ";
$fsql .= " Productname like '%$find%' or Product_description like '%$find%' or Product_thainame like '%$find%' ";
}
$sql="SELECT * FROM product $fsql";
$result = mysqli_query($con,$sql);
$num_rows = mysqli_num_rows($result);
$per_page = 50; // Per Page
$page = 1;
if(isset($_GET["Page"]))
{
$page = $_GET["Page"];
}
$prev_page = $page-1;
$next_page = $page+1;
$row_start = (($per_page*$page)-$per_page);
if($num_rows<=$per_page)
{
$num_pages =1;
}
else{
$num_pages = ceil($num_rows/$per_page);
$num_pages = (int)$num_pages;
}
$sql .= " ORDER BY Productname ASC LIMIT $row_start ,$per_page ";
$result = mysqli_query($con,$sql);
#print $sql;
echo "<table class='Thaimeetable'>
<tr>
<td>No.</td>
<td>Name</td>
<td>Description</td>
<td>Product (TH)</td>
<td>ShelfLife</td>
<td>Packing&Flavor</td>
<td>Edit</td>
</tr>";
$i = 1;
if($page > 1)
{
$i = ($per_page * ($page-1)) + 1;
}
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $i . "</td>";
echo "<td>" . $row['Productname'] . "</td>";
echo "<td>" . $row['Product_description'] . "</td>";
echo "<td>" . $row['Product_thainame'] . "</td>";
echo "<td>" . $row['ShelfLife'] . "</td>";
echo "</td><td>";
echo "<a href='product_packing_flavor.php?FilesID=".$row['ProductID']."Productname=".$row['Productname']."'target='_blank'>Packing&Flavor</a>";
echo "</td>";
echo "</td><td>";
echo "<a href='editproduct.php?FilesID=".$row['FilesID']."'target='_blank'>Edit</a>";
echo "</td>";
echo "</tr>";
$i++;
}
echo "</table>";
?>
<br>
Total <?php echo $num_rows;?> Record : <?php echo $num_pages;?> Page :
<?php
if($prev_page)
{
?>
<a href='javascript:void(0)' onclick="showUser('<?php print $q?>','<?php print $prev_page?>','<?php print $find?>')"><< Back</a>
<?php
}
for($i=1; $i<=$num_pages; $i++){
if($i != $page)
{
?>
[<a href='javascript:void(0)' onclick="showUser('<?php print $q?>','<?php print $i?>','<?php print $find?>')"><?php print $i?></a> ]
<?php
}
else
{
echo "<b> $i </b>";
}
}
if($page!=$num_pages)
{
?>
<a href='javascript:void(0)' onclick="showUser('<?php print $q?>','<?php print $next_page?>','<?php print $find?>')">Next >></a>
<?php
}
$conn = null;
mysqli_close($con);
?>
Code
<!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>Packing&Flavor</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/navigationmenu.css">
</head>
<body>
<ul id="menu">
<li><a href="main_purchase.php">Main</a></li>
<li>
<a href="#">Purchase</a>
<ul class="hidden">
<li><a href="poall.php" target="_blank"><span>Purchase Order</span></a></li>
<li><a href="Supplier.php" target="_blank"><span>Supplier List</span></a></li>
</ul>
</li>
<li><a href="product.php">Product</a></li>
<li><a href="login.php?action=logout">LOG OUT</a></li>
</ul>
<?php
$objConnect = mysql_connect("localhost","root","abcd1234") or die("Error Connect to Database");
$objDB = mysql_select_db("thaimee");
mysql_query("SET NAMES UTF8");
$strSQL = "SELECT * FROM packing WHERE ProductID = '".$_GET["FilesID"]."' " ;
$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>
<tr>
<div>
<?php echo $_GET['Productname']?>
</div>
</tr>
<table class="Thaimeetable">
<tr>
<td>Packing</td>
<td>Weight(kg)</td>
<td>Price</td>
<td>BoxWidth(cm)</td>
<td>BoxLength(cm)</td>
<td>BoxHeight(cm)</td>
<td>Boxsize(M3)</td>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><?php echo $objResult["Packing"];?></td>
<td><?php echo $objResult["weight"];?></td>
<td><?php echo $objResult["price"];?></td>
<td><?php echo $objResult["BoxWidth"];?></td>
<td><?php echo $objResult["BoxLength"];?></td>
<td><?php echo $objResult["BoxHeight"];?></td>
<td><?php echo $objResult["Boxsize"];?></td>
</tr>
<?
}
?>
</table><br />
<?
mysql_close($objConnect);
?>
<?php
$objConnect = mysql_connect("localhost","root","abcd1234") or die("Error Connect to Database");
$objDB = mysql_select_db("thaimee");
$strSQL = "SELECT * FROM flavor WHERE ProductID = '".$_GET["FilesID"]."' ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table class="Thaimeetable">
<tr>
<td>Flavor</td>
<td>Barcode</td>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><?php echo $objResult["Flavor_Name"];?></td>
<td><?php echo $objResult["Barcode"];?></td>
</tr>
<?
}
?>
</table><br />
<?
mysql_close($objConnect);
?>
</body>
</html>
Tag : PHP
|
|
|
|
|
|
Date :
2016-07-26 16:59:41 |
By :
athiwatbuun |
View :
1045 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่ยากครับก็แค่ส่งค่าไอดีสินค้าตามมากับลิงค์ แล้วก็คิวรี่อีกรอบครับ
|
|
|
|
|
Date :
2016-07-26 17:36:49 |
By :
Dragons_first |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองเพิ่ม && เชื่อมตัวแปรตัวต่อไปดู
href='product_packing_flavor.php?FilesID=".$row['ProductID']."&&Productname=".$row['Productname']."
|
ประวัติการแก้ไข 2016-07-27 08:46:34
|
|
|
|
Date :
2016-07-27 08:45:48 |
By :
thesin18598 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|