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 > สอบถามปัญหาครับ รายการรายละเอียดซื้อเข้าไม่showรายการตามรหัสสินค้านั้นๆครับ



 

สอบถามปัญหาครับ รายการรายละเอียดซื้อเข้าไม่showรายการตามรหัสสินค้านั้นๆครับ

 



Topic : 120238



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



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




หน้ารายการข้อมูลสินค้า โดยจะลิ้งไปหน้ารายละเอียดการซื้อเข้าโดยกด "เพิ่มเติม" ครับ โดยส่งค่า product_id ไปด้วย

สินค้า

ฐานข้อมูลสินค้า

ฐานข้อมูลสินค้า


code (Product.php) ข้อมูลสินค้าครับ

Code (PHP)
<?php require_once('Connections/MyConnect.php');
  
session_start(); 
mysql_select_db($database_MyConnect, $MyConnect);
$SQL="SELECT * FROM product 
LEFT JOIN category ON (product.cate_id=category.cate_id)
LEFT JOIN unit ON (product.unit_id=unit.unit_id)";
	
$QUERY= mysql_query($SQL) or die ("Error Query [".$SQL."]".mysql_error());   
	
$sql .= "ORDER BY `product_id` ASC ";
 ?>       
<?php
if (!isset($_SESSION)) {
 
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "admin/index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) 
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$maxRows_Productset = 5;
$pageNum_Productset = 0;
if (isset($_GET['pageNum_Productset'])) {
  $pageNum_Productset = $_GET['pageNum_Productset'];
}
$startRow_Productset = $pageNum_Productset * $maxRows_Productset;


$query_Productset = "SELECT * FROM product";
$query_limit_Productset = sprintf("%s LIMIT %d, %d", $query_Productset, $startRow_Productset, $maxRows_Productset);
$Productset = mysql_query($query_limit_Productset, $MyConnect) or die(mysql_error());
$row_Productset = mysql_fetch_assoc($Productset);

if (isset($_GET['totalRows_Productset'])) {
  $totalRows_Productset = $_GET['totalRows_Productset'];
} else {
  $all_Productset = mysql_query($query_Productset);
  $totalRows_Productset = mysql_num_rows($all_Productset);
}
$totalPages_Productset = ceil($totalRows_Productset/$maxRows_Productset)-1;
?>
<!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>Product</title>
<style type="text/css">
#MenuBar1 {
	font-size: 230%;
	font-family: "Courier New", Courier, monospace;
}
body p {
	font-size: 18px;
	text-align: center;
	color: #000;
}
body h2 {
	text-align: center;
}
#form1 #word {
	text-align: left;
}
#form1 #btnSearch {
	text-align: center;
}
#form1 {
	text-align: center;
}
</style>
<script src="js/jquery.js" type="text/javascript"></script>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
</head>

<body class='container'>
<p><img src="shop.jpg" width="1117" height="149" />
</p>
<h3>ร้านเกสร
</h3>
<p>ระบบจัดการฐานข้อมูลสำหรับร้านค้าปลีก</p>

<div class="btn-group">
  <button class="btn">ขายสินค้า</button>
</div>

<div class="btn-group">
  <button class="btn">ข้อมูลพื้นฐาน</button>
  <button class="btn dropdown-toggle" data-toggle="dropdown">
    <span class="caret"></span>
  </button>  
  <ul class="dropdown-menu">
    <li><a href="Product.php">ข้อมูลสินค้า</a></li>
    <li><a href="Category.php">ข้อมูลประเภทสินค้า</a></li>
    <li><a href="Supplier.php">ข้อมูลผู้จัดจำหน่าย</a></li>
    <!-- dropdown menu links -->
  </ul> 
</div>

<div class="btn-group">
  <button class="btn"><a href="Unit.php">หน่วยสินค้า</a></button>
</div>

<div class="btn-group">
  <button class="btn">จัดการลูกหนี้</button>
</div>

<div class="btn-group">  
  <button class="btn">เพิ่มเติม</button>
  <button class="btn dropdown-toggle" data-toggle="dropdown">
    <span class="caret"></span>
  </button>  
  <ul class="dropdown-menu">
    <li><a href="#">ดูสินค้าใกล้หมด</a></li>
    <li><a href="#">เช็คสต๊อกสินค้า</a></li>
    <!-- dropdown menu links -->
  </ul>
</div>

  <div class="btn-group">
  <button class="btn"><a href="edit-profile.php">แก้ไขข้อมูลส่วนตัว</a></button>
</div>

  <div class="btn-group">
  <button class="btn"><a href="admin/index.php">ออกจากระบบ</a></button>
</div>
<p>&nbsp;</p>

<form id="form1" name="form1" method="post" action="searchproduct.php">
  <label for="word">ค้นหา:<i class="icon-zoom-in"></i></label>
  <input type="text" name="word" id="word" />
  <input type="submit" name="btnSearch" id="btnSearch" value="ค้นหา" />
</form>
<p>
    <a href="insertproduct.php">
    <input type="submit" name="btn" id="btn" value="เพิ่มสินค้า" /></a></p>
<p>แสดงสินค้า </p>
<table class="table table-bordered" width="500" border="1" align="center">
  <tr class="success">
    <td width="159">รหัสสินค้า</td>
    <td width="181">ชื่อสินค้า</td>
    <td width="136">ประเภทสินค้า</td>
    <td width="132">หน่วยสินค้า</td>
    <td width="195">คงเหลือต่ำสุด</td>
    <td width="179">ราคา</td>
    <td width="27">แก้ไข</td>
    <td width="27">ลบ</td>
    <td width="27" align="center">เพิ่มเติม</td>
   </tr>

    <?php while($rs=mysql_fetch_array($QUERY))  {      ?>
    <tr>
      <td><?php echo $rs['product_id']; ?></td>
      <td><?php echo $rs['product_name']; ?></td>
      <td><?php echo $rs['cate_name']; ?></td>
      <td><?php echo $rs['unit_name']; ?></td>
      <td><?php echo $rs['product_balance']; ?></td>
      <td><?php echo $rs['product_price']; ?></td>
      <td><i class="icon-pencil"></i><a href="editproduct.php?product_id=<?php echo $rs['product_id']; ?>">แก้ไข</a></td>
      <td align="center"><i class="icon-trash"></i><a onclick="return confirm_delete()" href="deleteproduct.php?product_id=<?php echo $rs['product_id'];?>">ลบ</a></td>
      <td><i class="icon-asterisk"></i><a href="Purchase_detail.php?product_id=<?php echo $rs['product_id']; ?>">เพิ่มเติม</a></td>
    </tr>
    <?php } while ($row_Productset = mysql_fetch_assoc($Productset)); ?>
</table>
<p>
  หน้าที่:
  <?php
for($dw_i=0;$dw_i<=$totalPages_Productset;$dw_i++){
	echo '<a href="?pageNum_Productset=',$dw_i,'"class="pageNum">',($dw_i+1),'</a> ';
}
?>
</p>
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript">
function confirm_delete() {
  return confirm('ยืนยันการลบข้อมูล !');
}
</script>
<?php
mysql_free_result($Productset);
?>

หน้ารายละเอียดการซื้อเข้าของ product_id =1 ครับ ชื่อโคลาโคลา

รายละเอียด

ปัญหาก็คือพอกด "เพิ่มเติม" ที่product_id อื่นๆ เช่น product_id = 2 ชื่อ แฟนต้าเขียว มันควรจะไม่มีข้อมูลในหน้ารายละเอียดซื้อเข้า
เพระาว่ายังไม่เพิ่มข้อมูลรายละเอียดซื้อเข้าของ product_id = 2 ชื่อ แฟนต้าเขียว

ซ์้อเข้า

แต่ขึ้นหน้าข้อมูลของ product_id =1 เฉยครับโดยที่ลิ้งข้างบนส่งค่าเป็น product_id = 2 แท้ๆ (ลิ้งที่แถบน้ำเงินไว้ข้างบน) เลยอยากทราบว่าต้องแก้ปัญหายังไงครับ

น้ำเงิน

ฐานข้อมูล รายละเอียดการซ์้อเข้า

เขียว

code (purchase_detail.php) รายละเอียดซื้อเข้า

Code (PHP)
<?php require_once('Connections/MyConnect.php'); 


mysql_select_db($database_MyConnect, $MyConnect);
$SQL="select 
    pur_detail_id id,
	product_name name,
	DATE_FORMAT(pur_detail_date, '%d-%m-%Y') pur_date,
	pur_detail_principal pur_princ,
	pur_detail_productqty product_qty
from
purchase_detail INNER JOIN product
ON purchase_detail.pur_detail_id = product.product_id";

$QUERY= mysql_query($SQL) or die ("Error Query [".$SQL."]".mysql_error());  

$sql .= "ORDER BY `product_id` ASC ";
 ?>
<?php
if (!isset($_SESSION)) {
   session_start();
}
$MM_authorizedUsers = ""; 
$MM_donotCheckaccess = "true";


// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && true) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "admin/index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) 
  $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$maxRows_purchaseset1 = 5;
$pageNum_purchaseset1 = 0;
if (isset($_GET['pageNum_purchaseset1'])) {
  $pageNum_purchaseset1 = $_GET['pageNum_purchaseset1'];
}
$startRow_purchaseset1 = $pageNum_purchaseset1 * $maxRows_purchaseset1;


$query_purchaseset1 = "SELECT * FROM purchase_detail";
$query_limit_purchaseset1 = sprintf("%s LIMIT %d, %d", $query_purchaseset1, $startRow_purchaseset1, $maxRows_purchaseset1);
$purchaseset1 = mysql_query($query_limit_purchaseset1, $MyConnect) or die(mysql_error());
$row_purchaseset1 = mysql_fetch_assoc($purchaseset1);

if (isset($_GET['totalRows_purchaseset1'])) {
  $totalRows_purchaseset1 = $_GET['totalRows_purchaseset1'];
} else {
  $all_purchaseset1 = mysql_query($query_purchaseset1);
  $totalRows_purchaseset1 = mysql_num_rows($all_purchaseset1);
}
$totalPages_purchaseset1 = ceil($totalRows_purchaseset1/$maxRows_purchaseset1)-1;
?>
<!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>purchase_detail</title>

<script src="js/jquery.js" type="text/javascript"></script>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
</head>
<style type="text/css">
#MenuBar1 { 
	font-size: 230%;
	font-family: "Courier New", Courier, monospace;
}
body p {
	font-size: 18px;
	text-align: center;
	color: #000;
}
body h2 {
	text-align: center;
}
</style>

<body class='container'> 
<p><img src="shop.jpg" width="1117" height="149" />
</p>
<h3>ร้านเกสร
</h3>
<p>ระบบจัดการฐานข้อมูลสำหรับร้านค้าปลีก</p>

<div class="btn-group">
  <button class="btn">ขายสินค้า</button>
</div>

<div class="btn-group">
  <button class="btn">ข้อมูลพื้นฐาน</button>
  <button class="btn dropdown-toggle" data-toggle="dropdown">
    <span class="caret"></span>
  </button>  
  <ul class="dropdown-menu">
    <li><a href="Product.php">ข้อมูลสินค้า</a></li>
    <li><a href="Category.php">ข้อมูลประเภทสินค้า</a></li>
    <li><a href="Supplier.php">ข้อมูลผู้จัดจำหน่าย</a></li>
    <!-- dropdown menu links -->
  </ul> 
</div>

<div class="btn-group">
  <button class="btn"><a href="Unit.php">หน่วยสินค้า</a></button>
</div>

<div class="btn-group">
  <button class="btn">จัดการลูกหนี้</button>
</div>

<div class="btn-group">  
  <button class="btn">เพิ่มเติม</button>
  <button class="btn dropdown-toggle" data-toggle="dropdown">
    <span class="caret"></span>
  </button>  
  <ul class="dropdown-menu">
    <li><a href="#">ดูสินค้าใกล้หมด</a></li>
    <li><a href="#">เช็คสต๊อกสินค้า</a></li>
    <!-- dropdown menu links -->
  </ul>
</div>

  <div class="btn-group">
  <button class="btn"><a href="edit-profile.php">แก้ไขข้อมูลส่วนตัว</a></button>
</div>

  <div class="btn-group">
  <button class="btn"><a href="admin/index.php">ออกจากระบบ</a></button>
</div>
<p>&nbsp;</p>
<p>รายละเอียดการซื้อเข้า</p>
<p>
  <a href="addpurchase_detail.php?product_id=<?php echo $row_purchaseset1['product_id']; ?>"> 
  <input type="submit" name="btn" id="btn" value="เพิ่ม" />
</a></p>
<table table class="table table-bordered" width="105%" border="1">
  <tr class="success">
    <td width="196">รหัส</td>
    <td width="196">ชื่อสินค้า</td>
    <td width="213">วันที่ซื้อเข้า</td>
    <td width="238">ราคาต้นทุน</td>
    <td width="252">จำนวนสินค้าที่ซื้อเข้า</td>
    <td width="55">แก้ไข</td>
  </tr>
  <?php while($rs=mysql_fetch_array($QUERY))  {      ?>
    <tr>
      <td><?php echo $rs['id']; ?></td>
      <td><?php echo $rs['name']; ?></td>
      <td><?php echo $rs['pur_date']; ?></td>
      <td><?php echo $rs['pur_princ']; ?></td>
      <td><?php echo $rs['product_qty']; ?></td>
      <td><i class="icon-pencil"></i><a href="editpurchase_detail.php?pur_detail_id	=<?php echo $row_purchaseset1['pur_detail_id']; ?>">แก้ไข</a></td>
    </tr>
    <?php } while ($row_purchaseset1 = mysql_fetch_assoc($purchaseset1)); ?>
</table>
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>

</body>
</html>
<?php
mysql_free_result($purchaseset1);
?>




Tag : PHP, MySQL, HTML/CSS, JavaScript, CakePHP









ประวัติการแก้ไข
2015-11-29 21:55:22
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2015-11-29 18:36:23 By : suwidha View : 905 Reply : 10
 

 

No. 1



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



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

cropcode
เอาสีแดงครอบโค๊ดไว้ด้วยครับ ยาวๆ ก๊อปปียาก






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-11-29 21:05:49 By : NewbiePHP
 


 

No. 2



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



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


แก้ไขตรงส่วน code PHP เรียบร้อยแล้วครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-11-29 21:59:39 By : suwidha
 

 

No. 3



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



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

Product.php บันทัด 230 while(.....); ทำอะไรครับ

purchase_detail.php
บันทัดที่ 5-13 คิวรี่ detail แต่ไม่เห็น where เลย

อ่านไปงงไป จะคิวรี่อะไรกันแน่ เอาทั้งหมด หรือจะเอาแค่บางส่วน
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-11-29 23:58:34 By : NewbiePHP
 


 

No. 4



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



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


ตอบความคิดเห็นที่ : 3 เขียนโดย : NewbiePHP เมื่อวันที่ 2015-11-29 23:58:34
รายละเอียดของการตอบ ::
Product.php บันทัด 230 while(.....); (ขออภัยครับ จริงๆแล้วเป็นตัวแปร $rs ครับ )
<?php } while ($rs= mysql_fetch_assoc($Productset)); ?>
purchase_detail.php
บันทัดที่ 5-13 คิวรี่ detail มันเป็นการ join ตาราง purchase_detail กับ Product น่ะครับ
แค่บางส่วน code ส่วนที่มีปัญหาคือ
Code (PHP)
     <td><i class="icon-asterisk"></i><a href="Purchase_detail.php?product_id=<?php echo $rs['product_id']; ?>">เพิ่มเติม</a></td>


ส่งค่า product_id ไปก็ไม่เป็นหน้าของ id อื่น เป็นของ id=1 หมดเลย
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-11-30 09:38:44 By : suwidha
 


 

No. 5



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



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

<?php } while ($rs= mysql_fetch_assoc($Productset)); ?>

$rs มีแค่ record เดียวใช้ไหมครับถ้าใช้แก้เป็น ข้างล่างจะเข้าใจมากกว่า
Code (PHP)
<?php } 
$rs= mysql_fetch_assoc($Productset);
?>



และ purchase_detail.php
ที่บันทัดแรกเลย
Code (PHP)
<?php echo '<pre>',print_r($_REQUEST, true),'</pre>'; exit; 
// ทดสอบข้อความที่ส่งมา เมื่อเรียบร้อยแล้วให้เอาออก หรือ mark ไว้


แล้วเอาผลที่ได้มาแสดงหน่อยครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-11-30 09:57:14 By : NewbiePHP
 


 

No. 6



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



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


เอาไว้ข้างบนแบบนี้หรือเปล่าครับ

r

ผลที่ได้ครับ

ของ id=1
s


ของ id=2
a


ประวัติการแก้ไข
2015-11-30 11:07:02
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-11-30 11:06:20 By : suwidha
 


 

No. 7



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



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

$sdl .= " where condition"; // condition จะเปรียบเทียบอะไรก็ใส่เข้าไปครับ
ส่งอะไรมาก็เอามา where

เน้น Where ไม่เห็นมี
ใส่ where เข้าไปด้วย ไม่ where มันจะรู้ไหมครับว่าจะเอาอะไรออกมาโชว์
มันก็เอามาหมดอย่างที่เห็น

และที่เห็นแค่ record เดียว เพราะทดลองใส่ product 1 เข้าไปแค่อันเดียว ถูกต้องไหมครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-11-30 11:29:47 By : NewbiePHP
 


 

No. 8



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



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


ตอบความคิดเห็นที่ : 7 เขียนโดย : NewbiePHP เมื่อวันที่ 2015-11-30 11:29:47
รายละเอียดของการตอบ ::
$sdl .= " where condition"; เอามาใส่ใน
Code (PHP)
         $SQL="select 
    pur_detail_id id,
	product_name name,
	DATE_FORMAT(pur_detail_date, '%d-%m-%Y') pur_date,
	pur_detail_principal pur_princ,
	pur_detail_productqty product_qty
from
purchase_detail INNER JOIN product
ON purchase_detail.pur_detail_id = product.product_id";


หรือสร้างเป็น code บรรทัดใหม่ออกมาเลย เช่น $sdl .= " where condition";

และใช่ครับ ผมทดลองใส่ product 1 เข้าไปแค่อันเดียวครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-11-30 12:06:16 By : suwidha
 


 

No. 9



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



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

Code (PHP)
$pd=intval($_REQUEST['product_id']);
$SQL="select 
    pur_detail_id id,
	product_name name,
	DATE_FORMAT(pur_detail_date, '%d-%m-%Y') pur_date,
	pur_detail_principal pur_princ,
	pur_detail_productqty product_qty
from
purchase_detail INNER JOIN product
ON purchase_detail.pur_detail_id = product.product_id 
WHERE product.product_id=$pd
";

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-11-30 13:11:25 By : NewbiePHP
 


 

No. 10



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



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


ลองใช้ดูแล้วได้ผลครับ ขอบคุณมากครับผม

c
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-11-30 13:30:26 By : suwidha
 

   

ค้นหาข้อมูล


   
 

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