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 > จะให้เเจ้งเตือน ว่าจำนวนสินค้าไม่พอตรงไหนอะค่ะ เเล้วเขียนยังไงอะค่ะ



 

จะให้เเจ้งเตือน ว่าจำนวนสินค้าไม่พอตรงไหนอะค่ะ เเล้วเขียนยังไงอะค่ะ

 



Topic : 126182



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



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




Code (PHP)
<?php require_once('Connections/com.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
	
  $logoutGoTo = "Loginn.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?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 = "Loginn.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($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
  $MM_referrer .= "?" . $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;
}
}

mysql_select_db($database_com, $com);
$query_Recordset1 = "SELECT * FROM tb_product";
$Recordset1 = mysql_query($query_Recordset1, $com) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

$colname_Recordset2 = "-1";
if (isset($_POST['Product01'])) {
  $colname_Recordset2 = $_POST['Product01'];
}
mysql_select_db($database_com, $com);
$query_Recordset2 = sprintf("SELECT * FROM tb_product WHERE pro_name LIKE %s", GetSQLValueString("%" . $colname_Recordset2 . "%", "text"));
$Recordset2 = mysql_query($query_Recordset2, $com) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);

$colname_Recordset3 = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_Recordset3 = $_SESSION['MM_Username'];
}
mysql_select_db($database_com, $com);
$query_Recordset3 = sprintf("SELECT * FROM customer WHERE username = %s", GetSQLValueString($colname_Recordset3, "text"));
$Recordset3 = mysql_query($query_Recordset3, $com) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);

mysql_select_db($database_com, $com);
$query_Recordset4 = "SELECT * FROM customer";
$Recordset4 = mysql_query($query_Recordset4, $com) or die(mysql_error());
$row_Recordset4 = mysql_fetch_assoc($Recordset4);
$totalRows_Recordset4 = mysql_num_rows($Recordset4);
?>

<body onload="MM_preloadImages('รูป/หน้าหลัก1.gif','รูป/รูปภาพ1.gif','รูป/สินค้า1.gif','รูป/วีดีโอ้2.gif','รูป/ติดต่อ1.gif')">
<table width="1330" border="1" align="center">
  <tr>
    <td colspan="5" bgcolor="#000000"><div align="center"><img src="รูป/รูป.jpg" width="1300" height="300" /></div></td>
  </tr>
  <tr>
    <td height="47" colspan="4" bgcolor="#000000"><div align="center"><marquee>
      ยินดีตอนรับ คุณ &gt; &gt; &gt;  &gt; <?php echo $_SESSION['MM_Username']; ?>
    < < < <
    </marquee>
    </div></td>
    <td bgcolor="#000000"><div align="center"><a href="<?php echo $logoutAction ?>">ออกจากระบบ</a></div></td>
  </tr>
  <tr bgcolor="#000000">
    <td width="261" height="79"><a href="Home.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image7','','รูป/หน้าหลัก1.gif',1)"><img src="รูป/หน้าหลัก2.gif" name="Image7" width="250" height="75" border="0" id="Image7" /></a></td>
    <td width="262"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','รูป/สินค้า1.gif',1)"><img src="รูป/สินค้า2.gif" name="Image9" width="250" height="75" border="0" id="Image9" /></a></td>
    <td width="262"><a href="Photo.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','รูป/รูปภาพ1.gif',1)"><img src="รูป/รูปภาพ2.gif" name="Image8" width="250" height="75" border="0" id="Image8" /></a></td>
    <td width="264"><a href="VDO.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image10','','รูป/วีดีโอ้2.gif',1)"><img src="รูป/วีดีโอ้1.gif" name="Image10" width="250" height="75" border="0" id="Image10" /></a></td>
    <td width="250"><a href="Contact.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','รูป/ติดต่อ1.gif',1)"><img src="รูป/ติดต่อ2.gif" name="Image6" width="250" height="75" border="0" id="Image6" /></a></td>
  </tr>
  <tr bgcolor="#000000">
    <td rowspan="2" align="right" valign="top"><table width="266" border="1">
      <tr>
        <td width="256"><div align="center">
          <table width="262" border="1">
            <tr>
              <td width="94">รหัสลูกค้า</td>
              <td width="152"><? echo str_pad($row_Recordset4['member_id'],5,"TEE ",STR_PAD_LEFT); ?></td>
            </tr>
            <tr>
              <td>ชื่อ</td>
              <td><?php echo $row_Recordset4['name']; ?></td>
            </tr>
            <tr>
              <td>นามสกุล</td>
              <td><?php echo $row_Recordset4['lastname']; ?></td>
            </tr>
          </table>
        </div></td>
      </tr>
      <tr>
        <td><a href="showp.php"><img src="รูป/ตะกร้า.gif" width="268" height="70" /></a></td>
      </tr>
    </table>      <p>&nbsp;</p></td>
    <td height="104" colspan="3" valign="top" bgcolor="#000000"><img src="รูป/product00.jpg" width="800" height="100" /></td>
    <td rowspan="2" valign="top" bgcolor="#000000"><img src="รูป/images/ลดราคา...gif" width="250" height="510" hspace="0" vspace="0" align="top" /></td>
  
  </tr>
  <tr bgcolor="#000000">
    <td colspan="3" align="center" valign="top" bgcolor="#000000"><form name="frmSearch" method="post" action="<?=$_SERVER['SCRIPT_NAME'];?>">
  <table width="599" border="1">
    <tr>
      <th>
        Keyword
        <input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_POST["txtKeyword"];?>">
      <input type="submit" value="Search"></th>
    </tr>
  </table>
</form>
<?

	$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
	$objDB = mysql_select_db("com");
	mysql_query("SET NAMES UTF8");
	// Search By Name or Email
	$strSQL = "SELECT * FROM tb_product WHERE 1  ";
	if($_POST["ddlprotype_id"] != "")
	{
	 $strSQL .= " AND (protype_id = '".$_POST["ddlprotype_id"]."') ";
	}	
	if($_POST["txtKeyword"] != "")
	{
	 $strSQL .= " AND (pro_name LIKE '%".$_POST["txtKeyword"]."%' or protype_id LIKE '%".$_POST["txtKeyword"]."%' ) ";
	}
	$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
	?>
	<table width="800" border="1">
	  <tr align="center">
		<th width="56"> <div align="center">&#3619;&#3641;&#3611;&#3616;&#3634;&#3614;</div></th>
		<th width="20"><div align="center">รหัสสินค้า</div></th>
		<th width="100"> <div align="center">ชื่อสินค้า </div></th>
		<th width="150"> <div align="center">ประเภทสินค้า </div></th>
		<th width="300"> <div align="center">รายละเอียด </div></th>
		<th width="50"> <div align="center">ราคา </div></th>
		<th width="20"> <div align="center">จำนวน </div></th>
		<th colspan="2">Cart</th>
	  </tr>
	<?
	while($objResult = mysql_fetch_array($objQuery))
	{
	?>
	  <tr align="center">
      <form action="orderp.php" method="post">
		<td><div align="center"><img src="img-products/<?php echo $objResult["pro_image"];?>"></div></td>
		<td><?=$objResult["pro_id"];?></td>
		<td><?=$objResult["pro_name"];?></td>
		<td><?=$objResult["protype_id"];?></td>
		<td><div align="center"><?=$objResult["pro_detail"];?></div></td>
		<td><?=$objResult["pro_price"];?></td>
		<td><?=$objResult["pro_number"];?></td>
        
        
		<td width="100"><input type="hidden" name="txtpro_id" value="<?php echo $objResult["pro_id"];?>" size="2" />
          <input type="text" name="txtQty" value="1" size="3" /></td>
		<td width="34"><input name="add" type="submit" id="add" value="เพิ่ม" /></td>
        </form>
	  </tr>
	<?
	}
	?>
	</table>
	<?
	mysql_close($objConnect);
?>&nbsp;</td>
  </tr>
  <tr>
    <td height="300" colspan="5"><img src="รูป/images/ด้านล้างใหม่.gif" width="1300" height="300" /></td>
  </tr>
</table><html>
<head>
</body>
</html>
</body>
</html>
<?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset2);

mysql_free_result($Recordset3);

mysql_free_result($Recordset4);
?>




Tag : PHP, MySQL









ประวัติการแก้ไข
2017-01-29 00:12:48
2017-01-29 00:27:10
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2017-01-29 00:09:06 By : jeedjrad View : 1023 Reply : 17
 

 

No. 1



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



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


ช่วยที่นะค๊ะะะะะะะะะะะะะะ > <






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-29 00:11:02 By : เจ้าหญิง
 


 

No. 2



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



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


ควรจะแก้ที่ไฟล์ orderp.php นะครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-29 00:48:47 By : tomrambo
 

 

No. 3



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



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


ตรงไหนนะคะ


Code (PHP)
<?php
ob_start();
session_start();
	
if(!isset($_SESSION["intLine"]))
{
	if(isset($_POST["txtpro_id"]))
	{
		 $_SESSION["intLine"] = 0;
		 $_SESSION["strpro_id"][0] = $_POST["txtpro_id"];
		 $_SESSION["strQty"][0] = $_POST["txtQty"];

		 header("location:showp.php");
	}
}
else
{
	
	$key = array_search($_POST["txtpro_id"], $_SESSION["strpro_id"]);
	if((string)$key != "")
	{
		 $_SESSION["strQty"][$key] = $_SESSION["strQty"][$key] + $_POST["txtQty"];
	}
	else
	{
		
		 $_SESSION["intLine"] = $_SESSION["intLine"] + 1;
		 $intNewLine = $_SESSION["intLine"];
		 $_SESSION["strpro_id"][$intNewLine] = $_POST["txtpro_id"];
		 $_SESSION["strQty"][$intNewLine] = $_POST["txtQty"];
	}
	
	 header("location:showp.php");

}
?>

<?php /* This code download from www.ThaiCreate.Com */ ?>	



ประวัติการแก้ไข
2017-01-29 01:07:16
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-29 00:54:49 By : เจ้าหญิง
 


 

No. 4



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



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


- ชื่อไฟล์โค้ดอันแรกชื่อไฟล์อะไรครับ

- ชื่อฟิลด์เก็บจำนวนสินค้าใน database ชื่ออะไรครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-29 11:14:31 By : tomrambo
 


 

No. 5



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



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


ตอบความคิดเห็นที่ : 4 เขียนโดย : tomrambo เมื่อวันที่ 2017-01-29 11:14:31
รายละเอียดของการตอบ ::
... ใส่ความคิดเห็นตรงนี้.......ชื่อไฟล์โค้ดอันแรก Product คะ
เเล้วเก็บจำนวนสินค้า pro_number ตามนี้ค่ะ


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-29 11:19:42 By : เเพรว
 


 

No. 6



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



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


ตอบความคิดเห็นที่ : 5 เขียนโดย : เเพรว เมื่อวันที่ 2017-01-29 11:19:42
รายละเอียดของการตอบ ::
โอเคครับ เดี๋ยวคืนนี้มาตอบครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-29 11:41:13 By : tomrambo
 


 

No. 7



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



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


ตอบความคิดเห็นที่ : 6 เขียนโดย : tomrambo เมื่อวันที่ 2017-01-29 11:41:13
รายละเอียดของการตอบ ::
...ขอบคุณนะคะ


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-29 11:43:31 By : เเพรว
 


 

No. 8



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



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


ไฟล์ product.php

<?php require_once('Connections/com.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);

  $logoutGoTo = "Loginn.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?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 = "Loginn.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($QUERY_STRING) && strlen($QUERY_STRING) > 0)
  $MM_referrer .= "?" . $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;
}
}

mysql_select_db($database_com, $com);
$query_Recordset1 = "SELECT * FROM tb_product";
$Recordset1 = mysql_query($query_Recordset1, $com) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

$colname_Recordset2 = "-1";
if (isset($_POST['Product01'])) {
  $colname_Recordset2 = $_POST['Product01'];
}
mysql_select_db($database_com, $com);
$query_Recordset2 = sprintf("SELECT * FROM tb_product WHERE pro_name LIKE %s", GetSQLValueString("%" . $colname_Recordset2 . "%", "text"));
$Recordset2 = mysql_query($query_Recordset2, $com) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);

$colname_Recordset3 = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_Recordset3 = $_SESSION['MM_Username'];
}
mysql_select_db($database_com, $com);
$query_Recordset3 = sprintf("SELECT * FROM customer WHERE username = %s", GetSQLValueString($colname_Recordset3, "text"));
$Recordset3 = mysql_query($query_Recordset3, $com) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);

mysql_select_db($database_com, $com);
$query_Recordset4 = "SELECT * FROM customer";
$Recordset4 = mysql_query($query_Recordset4, $com) or die(mysql_error());
$row_Recordset4 = mysql_fetch_assoc($Recordset4);
$totalRows_Recordset4 = mysql_num_rows($Recordset4);
?>
<!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>ThaiCreate.Com PHP & MySQL Tutorial</title>
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

function uzXmlHttp(){
    var xmlhttp = false;
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(e){
            xmlhttp = false;
        }
    }

    if(!xmlhttp && document.createElement){
        xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}
function checkQTY(msg, p_id){

var p_qty = document.getElementById('txtQty').value;
var xhr = uzXmlHttp();
xhr.open ("POST","checkQTY.php");
xhr.onreadystatechange = responseXHR;
xhr.setRequestHeader ("Content-type", "application/x-www-form-urlencoded");
xhr.send("product_id="+p_id+"product_qty="+p_qty);

function responseXHR()
{
  if ( xhr.readyState == 4 )
       {
            if ( xhr.status == 200 )
            {
                 if(xhr.responseText == 1){
                   document.form_1.submit();
                 }else{
                   alert(msg);
                 }
            }
       }
}

}

</script>
<style type="text/css">
<!--
#apDiv1 {
	position:absolute;
	left:1065px;
	top:405px;
	width:250px;
	height:510px;
	z-index:1;
}
#apDiv2 {
	position:absolute;
	left:19px;
	top:921px;
	width:1298px;
	height:150px;
	z-index:1;
}
#apDiv3 {
	position:absolute;
	left:538px;
	top:970px;
	width:846px;
	height:214px;
	z-index:1;
}
body {
	background-color: #CCC;
}
#apDiv4 {
	position:absolute;
	left:17px;
	top:406px;
	width:255px;
	height:325px;
	z-index:1;
}
-->
</style>
<link href="login.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body,td,th {
	color: #FFF;
	font-size: 24px;
	font-family: FontNongnam;
}
#form1 {
	font-family: PL-EDIT;
}
body p {
	font-family: Verdana, Geneva, sans-serif;
}
body p {
	font-family: PL-EDIT;
}
body p {
	font-family: FontNongnam;
}
body table tr td div marquee {
	font-size: 36px;
}
body table tr td div a {
	font-size: 36px;
}
td {
	color: #000;
}
td {
	color: #FFF;
}
-->
</style></head>

<body onload="MM_preloadImages('รูป/หน้าหลัก1.gif','รูป/รูปภาพ1.gif','รูป/สินค้า1.gif','รูป/วีดีโอ้2.gif','รูป/ติดต่อ1.gif')">
<table width="1330" border="1" align="center">
  <tr>
    <td colspan="5" bgcolor="#000000"><div align="center"><img src="รูป/รูป.jpg" width="1300" height="300" /></div></td>
  </tr>
  <tr>
    <td height="47" colspan="4" bgcolor="#000000"><div align="center"><marquee>
      ยินดีตอนรับ คุณ &gt; &gt; &gt;  &gt; <?php echo $_SESSION['MM_Username']; ?>
    < < < <
    </marquee>
    </div></td>
    <td bgcolor="#000000"><div align="center"><a href="<?php echo $logoutAction ?>">ออกจากระบบ</a></div></td>
  </tr>
  <tr bgcolor="#000000">
    <td width="261" height="79"><a href="Home.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image7','','รูป/หน้าหลัก1.gif',1)"><img src="รูป/หน้าหลัก2.gif" name="Image7" width="250" height="75" border="0" id="Image7" /></a></td>
    <td width="262"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','รูป/สินค้า1.gif',1)"><img src="รูป/สินค้า2.gif" name="Image9" width="250" height="75" border="0" id="Image9" /></a></td>
    <td width="262"><a href="Photo.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','รูป/รูปภาพ1.gif',1)"><img src="รูป/รูปภาพ2.gif" name="Image8" width="250" height="75" border="0" id="Image8" /></a></td>
    <td width="264"><a href="VDO.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image10','','รูป/วีดีโอ้2.gif',1)"><img src="รูป/วีดีโอ้1.gif" name="Image10" width="250" height="75" border="0" id="Image10" /></a></td>
    <td width="250"><a href="Contact.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','รูป/ติดต่อ1.gif',1)"><img src="รูป/ติดต่อ2.gif" name="Image6" width="250" height="75" border="0" id="Image6" /></a></td>
  </tr>
  <tr bgcolor="#000000">
    <td rowspan="2" align="right" valign="top"><table width="266" border="1">
      <tr>
        <td width="256"><div align="center">
          <table width="262" border="1">
            <tr>
              <td width="94">รหัสลูกค้า</td>
              <td width="152"><? echo str_pad($row_Recordset4['member_id'],5,"TEE ",STR_PAD_LEFT); ?></td>
            </tr>
            <tr>
              <td>ชื่อ</td>
              <td><?php echo $row_Recordset4['name']; ?></td>
            </tr>
            <tr>
              <td>นามสกุล</td>
              <td><?php echo $row_Recordset4['lastname']; ?></td>
            </tr>
          </table>
        </div></td>
      </tr>
      <tr>
        <td><a href="showp.php"><img src="รูป/ตะกร้า.gif" width="268" height="70" /></a></td>
      </tr>
    </table>      <p>&nbsp;</p></td>
    <td height="104" colspan="3" valign="top" bgcolor="#000000"><img src="รูป/product00.jpg" width="800" height="100" /></td>
    <td rowspan="2" valign="top" bgcolor="#000000"><img src="รูป/images/ลดราคา...gif" width="250" height="510" hspace="0" vspace="0" align="top" /></td>

  </tr>
  <tr bgcolor="#000000">
    <td colspan="3" align="center" valign="top" bgcolor="#000000"><form name="frmSearch" method="post" action="<?=$_SERVER['SCRIPT_NAME'];?>">
  <table width="599" border="1">
    <tr>
      <th>
        Keyword
        <input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_POST["txtKeyword"];?>">
      <input type="submit" value="Search"></th>
    </tr>
  </table>
</form>
<?

	$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
	$objDB = mysql_select_db("com");
	mysql_query("SET NAMES UTF8");
	// Search By Name or Email
	$strSQL = "SELECT * FROM tb_product WHERE 1  ";
	if($_POST["ddlprotype_id"] != "")
	{
	 $strSQL .= " AND (protype_id = '".$_POST["ddlprotype_id"]."') ";
	}
	if($_POST["txtKeyword"] != "")
	{
	 $strSQL .= " AND (pro_name LIKE '%".$_POST["txtKeyword"]."%' or protype_id LIKE '%".$_POST["txtKeyword"]."%' ) ";
	}
	$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
	?>
	<table width="800" border="1">
	  <tr align="center">
		<th width="56"> <div align="center">&#3619;&#3641;&#3611;&#3616;&#3634;&#3614;</div></th>
		<th width="20"><div align="center">รหัสสินค้า</div></th>
		<th width="100"> <div align="center">ชื่อสินค้า </div></th>
		<th width="150"> <div align="center">ประเภทสินค้า </div></th>
		<th width="300"> <div align="center">รายละเอียด </div></th>
		<th width="50"> <div align="center">ราคา </div></th>
		<th width="20"> <div align="center">จำนวน </div></th>
		<th colspan="2">Cart</th>
	  </tr>
	<?
	while($objResult = mysql_fetch_array($objQuery))
	{
	?>
	  <tr align="center">
      <form name="form_1" action="orderp.php" method="post">
		<td><div align="center"><img src="img-products/<?php echo $objResult["pro_image"];?>"></div></td>
		<td><?=$objResult["pro_id"];?></td>
		<td><?=$objResult["pro_name"];?></td>
		<td><?=$objResult["protype_id"];?></td>
		<td><div align="center"><?=$objResult["pro_detail"];?></div></td>
		<td><?=$objResult["pro_price"];?></td>
		<td><?=$objResult["pro_number"];?></td>


		<td width="100"><input type="hidden" name="txtpro_id" value="<?php echo $objResult["pro_id"];?>" size="2" />
          <input type="text" name="txtQty" id="txtQty" value="1" size="3" /></td>
		<td width="34"><input name="add_button" type="button" value="เพิ่ม" onclick="checkQTY('ขออภัย! จำนวนสินค้ามีไม่เพียงพอ', '<?php echo $objResult['pro_id'] ?>')" /></td>
        </form>
	  </tr>
	<?
	}
	?>
	</table>
	<?
	mysql_close($objConnect);
?>&nbsp;</td>
  </tr>
  <tr>
    <td height="300" colspan="5"><img src="รูป/images/ด้านล้างใหม่.gif" width="1300" height="300" /></td>
  </tr>
</table><html>
<head>
</body>
</html>
</body>
</html>
<?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset2);

mysql_free_result($Recordset3);

mysql_free_result($Recordset4);
?>





สร้างไฟล์ชื่อ checkQTY.php ขึ้นมาแล้วใส่โค้ดด้านล่างลงไปครับ

<?php
require('Connections/com.php');
mysql_select_db($database_com, $com);
$sql = mysql_query("SELECT pro_number FROM tb_product WHERE pro_id = '".$_POST['product_id']."'") or die("Database Error!");
$result = mysql_fetch_assoc($sql);
if(($result['pro_number'] - $_POST['product_qty']) >= 0){
  echo 1;
}else{
  echo 0;
}
?>




ประวัติการแก้ไข
2017-01-29 22:45:53
2017-01-29 22:46:53
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-29 22:45:08 By : tomrambo
 


 

No. 9



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



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


ขอบคุณนะคะ เพิ่งไปต่างจังหวะเพิ่งกลับคะ จะลองนะคะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-30 20:38:38 By : เเพรว
 


 

No. 10



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



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


ตอบความคิดเห็นที่ : 8 เขียนโดย : tomrambo เมื่อวันที่ 2017-01-29 22:45:08
รายละเอียดของการตอบ ::
... ใส่ความคิดเห็นตรงนี้.......มันกดเพิ่มไม่ได้เลยอะคะ งง เลยเป็นเพราะอะไรเอ้ย

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-30 20:47:54 By : เเพรว
 


 

No. 11



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



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


ดูว่ามัน Alert แจ้งว่าอย่างไรครับ

<?php require_once('Connections/com.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);

  $logoutGoTo = "Loginn.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?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 = "Loginn.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($QUERY_STRING) && strlen($QUERY_STRING) > 0)
  $MM_referrer .= "?" . $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;
}
}

mysql_select_db($database_com, $com);
$query_Recordset1 = "SELECT * FROM tb_product";
$Recordset1 = mysql_query($query_Recordset1, $com) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

$colname_Recordset2 = "-1";
if (isset($_POST['Product01'])) {
  $colname_Recordset2 = $_POST['Product01'];
}
mysql_select_db($database_com, $com);
$query_Recordset2 = sprintf("SELECT * FROM tb_product WHERE pro_name LIKE %s", GetSQLValueString("%" . $colname_Recordset2 . "%", "text"));
$Recordset2 = mysql_query($query_Recordset2, $com) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);

$colname_Recordset3 = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_Recordset3 = $_SESSION['MM_Username'];
}
mysql_select_db($database_com, $com);
$query_Recordset3 = sprintf("SELECT * FROM customer WHERE username = %s", GetSQLValueString($colname_Recordset3, "text"));
$Recordset3 = mysql_query($query_Recordset3, $com) or die(mysql_error());
$row_Recordset3 = mysql_fetch_assoc($Recordset3);
$totalRows_Recordset3 = mysql_num_rows($Recordset3);

mysql_select_db($database_com, $com);
$query_Recordset4 = "SELECT * FROM customer";
$Recordset4 = mysql_query($query_Recordset4, $com) or die(mysql_error());
$row_Recordset4 = mysql_fetch_assoc($Recordset4);
$totalRows_Recordset4 = mysql_num_rows($Recordset4);
?>
<!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>ThaiCreate.Com PHP & MySQL Tutorial</title>
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

function uzXmlHttp(){
    var xmlhttp = false;
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(e){
            xmlhttp = false;
        }
    }

    if(!xmlhttp && document.createElement){
        xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}
function checkQTY(msg, p_id){

var p_qty = document.getElementById('txtQty').value;
var xhr = uzXmlHttp();
xhr.open ("POST","checkQTY.php");
xhr.onreadystatechange = responseXHR;
xhr.setRequestHeader ("Content-type", "application/x-www-form-urlencoded");
xhr.send("product_id="+p_id+"product_qty="+p_qty);

function responseXHR()
{
  if ( xhr.readyState == 4 )
       {
            if ( xhr.status == 200 )
            {
                 alert(xhr.responseText);
            }
       }
}

}

</script>
<style type="text/css">
<!--
#apDiv1 {
	position:absolute;
	left:1065px;
	top:405px;
	width:250px;
	height:510px;
	z-index:1;
}
#apDiv2 {
	position:absolute;
	left:19px;
	top:921px;
	width:1298px;
	height:150px;
	z-index:1;
}
#apDiv3 {
	position:absolute;
	left:538px;
	top:970px;
	width:846px;
	height:214px;
	z-index:1;
}
body {
	background-color: #CCC;
}
#apDiv4 {
	position:absolute;
	left:17px;
	top:406px;
	width:255px;
	height:325px;
	z-index:1;
}
-->
</style>
<link href="login.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body,td,th {
	color: #FFF;
	font-size: 24px;
	font-family: FontNongnam;
}
#form1 {
	font-family: PL-EDIT;
}
body p {
	font-family: Verdana, Geneva, sans-serif;
}
body p {
	font-family: PL-EDIT;
}
body p {
	font-family: FontNongnam;
}
body table tr td div marquee {
	font-size: 36px;
}
body table tr td div a {
	font-size: 36px;
}
td {
	color: #000;
}
td {
	color: #FFF;
}
-->
</style></head>

<body onload="MM_preloadImages('รูป/หน้าหลัก1.gif','รูป/รูปภาพ1.gif','รูป/สินค้า1.gif','รูป/วีดีโอ้2.gif','รูป/ติดต่อ1.gif')">
<table width="1330" border="1" align="center">
  <tr>
    <td colspan="5" bgcolor="#000000"><div align="center"><img src="รูป/รูป.jpg" width="1300" height="300" /></div></td>
  </tr>
  <tr>
    <td height="47" colspan="4" bgcolor="#000000"><div align="center"><marquee>
      ยินดีตอนรับ คุณ &gt; &gt; &gt;  &gt; <?php echo $_SESSION['MM_Username']; ?>
    < < < <
    </marquee>
    </div></td>
    <td bgcolor="#000000"><div align="center"><a href="<?php echo $logoutAction ?>">ออกจากระบบ</a></div></td>
  </tr>
  <tr bgcolor="#000000">
    <td width="261" height="79"><a href="Home.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image7','','รูป/หน้าหลัก1.gif',1)"><img src="รูป/หน้าหลัก2.gif" name="Image7" width="250" height="75" border="0" id="Image7" /></a></td>
    <td width="262"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','รูป/สินค้า1.gif',1)"><img src="รูป/สินค้า2.gif" name="Image9" width="250" height="75" border="0" id="Image9" /></a></td>
    <td width="262"><a href="Photo.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','รูป/รูปภาพ1.gif',1)"><img src="รูป/รูปภาพ2.gif" name="Image8" width="250" height="75" border="0" id="Image8" /></a></td>
    <td width="264"><a href="VDO.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image10','','รูป/วีดีโอ้2.gif',1)"><img src="รูป/วีดีโอ้1.gif" name="Image10" width="250" height="75" border="0" id="Image10" /></a></td>
    <td width="250"><a href="Contact.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','รูป/ติดต่อ1.gif',1)"><img src="รูป/ติดต่อ2.gif" name="Image6" width="250" height="75" border="0" id="Image6" /></a></td>
  </tr>
  <tr bgcolor="#000000">
    <td rowspan="2" align="right" valign="top"><table width="266" border="1">
      <tr>
        <td width="256"><div align="center">
          <table width="262" border="1">
            <tr>
              <td width="94">รหัสลูกค้า</td>
              <td width="152"><? echo str_pad($row_Recordset4['member_id'],5,"TEE ",STR_PAD_LEFT); ?></td>
            </tr>
            <tr>
              <td>ชื่อ</td>
              <td><?php echo $row_Recordset4['name']; ?></td>
            </tr>
            <tr>
              <td>นามสกุล</td>
              <td><?php echo $row_Recordset4['lastname']; ?></td>
            </tr>
          </table>
        </div></td>
      </tr>
      <tr>
        <td><a href="showp.php"><img src="รูป/ตะกร้า.gif" width="268" height="70" /></a></td>
      </tr>
    </table>      <p>&nbsp;</p></td>
    <td height="104" colspan="3" valign="top" bgcolor="#000000"><img src="รูป/product00.jpg" width="800" height="100" /></td>
    <td rowspan="2" valign="top" bgcolor="#000000"><img src="รูป/images/ลดราคา...gif" width="250" height="510" hspace="0" vspace="0" align="top" /></td>

  </tr>
  <tr bgcolor="#000000">
    <td colspan="3" align="center" valign="top" bgcolor="#000000"><form name="frmSearch" method="post" action="<?=$_SERVER['SCRIPT_NAME'];?>">
  <table width="599" border="1">
    <tr>
      <th>
        Keyword
        <input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_POST["txtKeyword"];?>">
      <input type="submit" value="Search"></th>
    </tr>
  </table>
</form>
<?

	$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
	$objDB = mysql_select_db("com");
	mysql_query("SET NAMES UTF8");
	// Search By Name or Email
	$strSQL = "SELECT * FROM tb_product WHERE 1  ";
	if($_POST["ddlprotype_id"] != "")
	{
	 $strSQL .= " AND (protype_id = '".$_POST["ddlprotype_id"]."') ";
	}
	if($_POST["txtKeyword"] != "")
	{
	 $strSQL .= " AND (pro_name LIKE '%".$_POST["txtKeyword"]."%' or protype_id LIKE '%".$_POST["txtKeyword"]."%' ) ";
	}
	$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
	?>
	<table width="800" border="1">
	  <tr align="center">
		<th width="56"> <div align="center">&#3619;&#3641;&#3611;&#3616;&#3634;&#3614;</div></th>
		<th width="20"><div align="center">รหัสสินค้า</div></th>
		<th width="100"> <div align="center">ชื่อสินค้า </div></th>
		<th width="150"> <div align="center">ประเภทสินค้า </div></th>
		<th width="300"> <div align="center">รายละเอียด </div></th>
		<th width="50"> <div align="center">ราคา </div></th>
		<th width="20"> <div align="center">จำนวน </div></th>
		<th colspan="2">Cart</th>
	  </tr>
	<?
	while($objResult = mysql_fetch_array($objQuery))
	{
	?>
	  <tr align="center">
      <form name="form_1" action="orderp.php" method="post">
		<td><div align="center"><img src="img-products/<?php echo $objResult["pro_image"];?>"></div></td>
		<td><?=$objResult["pro_id"];?></td>
		<td><?=$objResult["pro_name"];?></td>
		<td><?=$objResult["protype_id"];?></td>
		<td><div align="center"><?=$objResult["pro_detail"];?></div></td>
		<td><?=$objResult["pro_price"];?></td>
		<td><?=$objResult["pro_number"];?></td>


		<td width="100"><input type="hidden" name="txtpro_id" value="<?php echo $objResult["pro_id"];?>" size="2" />
          <input type="text" name="txtQty" id="txtQty" value="1" size="3" /></td>
		<td width="34"><input name="add_button" type="button" value="เพิ่ม" onclick="checkQTY('ขออภัย! จำนวนสินค้ามีไม่เพียงพอ', '<?php echo $objResult['pro_id'] ?>')" /></td>
        </form>
	  </tr>
	<?
	}
	?>
	</table>
	<?
	mysql_close($objConnect);
?>&nbsp;</td>
  </tr>
  <tr>
    <td height="300" colspan="5"><img src="รูป/images/ด้านล้างใหม่.gif" width="1300" height="300" /></td>
  </tr>
</table><html>
<head>
</body>
</html>
</body>
</html>
<?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset2);

mysql_free_result($Recordset3);

mysql_free_result($Recordset4);
?>




ประวัติการแก้ไข
2017-01-30 21:03:45
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-30 21:02:55 By : tomrambo
 


 

No. 12



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



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


ตอบความคิดเห็นที่ : 11 เขียนโดย : tomrambo เมื่อวันที่ 2017-01-30 21:02:55
รายละเอียดของการตอบ ::
กดเเล้วมันขึ้น 1 มันเเจ้งเตือนมาเป็น 1 กด10จำนวนก็ ขึ้น 1




ประวัติการแก้ไข
2017-01-30 21:20:23
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-30 21:19:10 By : เเพรว
 


 

No. 13



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



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


แล้วลองใส่เกินจำนวนสินค้าที่มีในสต๊อกมัน Alert ว่าไรหรอครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-30 21:22:56 By : tomrambo
 


 

No. 14



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



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


ตอบความคิดเห็นที่ : 13 เขียนโดย : tomrambo เมื่อวันที่ 2017-01-30 21:22:56
รายละเอียดของการตอบ ::
ก็ 1 อะ เลยงงเลย


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-30 21:23:56 By : เเพรว
 


 

No. 15



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



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


เช็คข้อความส่วนตัวด้วยครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-30 21:29:49 By : tomrambo
 


 

No. 16



โพสกระทู้ ( 2,249 )
บทความ ( 5 )

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

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

จขกท. ลองคิดเหตุผลง่ายๆครับ แล้วนำไปใช้สร้างเงื่อนไขในระบบ ตะกร้าสินค้าของเรา

สมมุติเรามีเงิน 10 บาท ต้องการซื้อของ โดยจำลองสินค้า ดังนี้

Code (PHP)
$money = 10; //เงินที่เรามี

//สินค้า

$apple = 20;
$mango = 10;
$orange = 5;

$cart = ""; //ตะกร้าสินค้า
$buy_product = ""; //สินค้าที่เลือก และอยากซื้อ

if($buy_product == "apple"){
$money-$apple; //= -10
echo "ซื้อไม่ได้ เงินไม่พอ";
}else if($buy_product == "mango "){
$money-$apple; //= 0
echo "ซื้อได้ เงินพอ";
}else if($buy_product == "orange"){
$money-$orange ; //= 5
echo "ซื้อได้ เงินเหลือ";
}

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-01-31 04:40:53 By : Manussawin
 


 

No. 17



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



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


ตอบความคิดเห็นที่ : 16 เขียนโดย : Manussawin เมื่อวันที่ 2017-01-31 04:40:53
รายละเอียดของการตอบ ::
ขอบคุณ ค่ะ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-02-02 00:02:41 By : เเพรว
 

   

ค้นหาข้อมูล


   
 

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