|  | 
	                
  
    | 
	 
        ขอสอบถามเรื่องเลขลำดับหน่อยค่ะ คือในแต่ละหน้ามันไม่ตรงกัน     |  
    |  |  
 
	
		|  |  |  |  |  
		|  |  | 
          
            | คือจากหน้านี้พอเรากดไปที่แก้ไข เลขลำดับมันไม่เหมือนในหน้าตารางแสดงข้อมูลอะค่ะ 
 
  
 พอกดแก้ไขตรงลำดับ 1 แล้วมาหน้าแก้ไข ตรงลำดับมันไม่ตรงค่ะ
 
 
  
 ลำดับในฐานข้อมูลด้วยค่ะ มันไม่ตรงกับในตารางแสดงข้อมูล
 
 
  
 ต้องแก้ไขยังไงหรอคะ  ขอบคุณค่ะ
 
 โค้ดหน้าตารางแสดงข้อมูลค่ะ
 
 <?php require_once('Connections/AddDataCustomers.php'); 
include("header.php");
mysql_query("SET NAMES UTF8");
?>
<?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_AddDataCustomers, $AddDataCustomers);
$query_ShowData = "SELECT * FROM data_customers";
$ShowData = mysql_query($query_ShowData, $AddDataCustomers) or die(mysql_error());
$row_ShowData = mysql_fetch_assoc($ShowData);
$i=1;
$totalRows_ShowData = mysql_num_rows($ShowData);
?>
<!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>Untitled Document</title>
</head>
<body>
  <p> </p>
  <p> </p>
  <center>
    <p><b>ข้อมูลลูกค้าที่นำเครื่องมาซ่อม</b> </p>
    <p> </p>
</center>
  
<table width="1170" border="0" align="center">
  <tr>
    <td width="42" align="center" bgcolor="#00CC66"><strong>ลำดับ</strong></td>
    <td width="151" align="center" bgcolor="#00CC66"><strong>ชื่อ</strong></td>
    <td width="170" align="center" bgcolor="#00CC66"><strong>นามสกุล</strong></td>
    <td width="172" align="center" bgcolor="#00CC66"><strong>ยี่ห้อมือถือ</strong></td>
    <td width="127" align="center" bgcolor="#00CC66"><strong>รุ่น</strong></td>
    <td width="127" align="center" bgcolor="#00CC66"><strong>เบอร์ติดต่อ</strong></td>
    <td width="145" align="center" bgcolor="#00CC66"><strong>วันที่มาซ่อม</strong></td>
    <td width="132" align="center" bgcolor="#00CC66"><strong>บริการที่เข้ารับ</strong></td>
    <td colspan="2" align="center" bgcolor="#00CC66"><strong>ตัวเลือก</strong></td>
  </tr>
  <?php do { ;   ?>
    <tr>
      <td><?php echo $i++; ?></td>
      <td><?php echo $row_ShowData['ctm_name']; ?></td>
      <td><?php echo $row_ShowData['ctm_surname']; ?></td>
      <td><?php echo $row_ShowData['ctm_product']; ?></td>
      <td><?php echo $row_ShowData['ctm_model']; ?></td>
      <td><?php echo $row_ShowData['ctm_tel']; ?></td>
      <td><?php echo $row_ShowData['ctm_date']; ?></td>
      <td><?php echo $row_ShowData['ctm_fix']; ?></td>
      <td width="20" align="center"><a href="delete.php?ctm_id=<?php echo $row_ShowData['ctm_id']; ?>" onclick="return confirm('คุณแน่ใจที่จะลบ <?php echo $row_ShowData['ctm_name']; ?>');">ลบ</a></td>
      <td width="42" align="center"><a href="update.php?ctm_id=<?php echo $row_ShowData['ctm_id']; ?>">แก้ไข</a></td>
    </tr>
    <?php   }   while ($row_ShowData = mysql_fetch_assoc($ShowData));  ?>
</table>
<p> </p>
 <center><form id="form1" name="form1" method="post" action="search.php">
   <label for="word"> ค้นหา :</label>
    <input type="text" name="word" id="word" />
    <input type="submit" name="btnsearch" id="btnsearch" value="Submit" />
  </form></center>
</body>
</html>
<?php
mysql_free_result($ShowData);
?>
 โค้ดหน้าแก้ไขข้อมูลค่ะ
 
 <?php require_once('Connections/AddDataCustomers.php'); ?>
<?php require_once('Connections/AddDataCustomers.php'); ?>
<?php require_once('Connections/AddDataCustomers.php');
include("header.php")
 ?>
<?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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE data_customers SET ctm_name=%s, ctm_surname=%s, ctm_product=%s, ctm_model=%s, ctm_tel=%s, ctm_date=%s, ctm_fix=%s WHERE ctm_id=%s",
                       GetSQLValueString($_POST['ctm_name'], "text"),
                       GetSQLValueString($_POST['ctm_surname'], "text"),
                       GetSQLValueString($_POST['ctm_product'], "text"),
					   GetSQLValueString($_POST['ctm_model'], "text"),
                       GetSQLValueString($_POST['ctm_tel'], "int"),
                       GetSQLValueString($_POST['ctm_date'], "date"),
                       GetSQLValueString($_POST['ctm_fix'], "text"),
                       GetSQLValueString($_POST['ctm_id'], "int"));
  mysql_select_db($database_AddDataCustomers, $AddDataCustomers);
  $Result1 = mysql_query($updateSQL, $AddDataCustomers) or die(mysql_error());
  $updateGoTo = "data-table.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}
$colname_Recordset1 = "-1";
if (isset($_GET['ctm_id'])) {
  $colname_Recordset1 = $_GET['ctm_id'];
}
mysql_select_db($database_AddDataCustomers, $AddDataCustomers);
$query_Recordset1 = sprintf("SELECT * FROM data_customers WHERE ctm_id = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $AddDataCustomers) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$colname_Recordset2 = "-1";
if (isset($_GET['ctm_id'])) {
  $colname_Recordset2 = $_GET['ctm_id'];
}
mysql_select_db($database_AddDataCustomers, $AddDataCustomers);
$query_Recordset2 = sprintf("SELECT * FROM data_customers WHERE ctm_id = %s", GetSQLValueString($colname_Recordset2, "int"));
$Recordset2 = mysql_query($query_Recordset2, $AddDataCustomers) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<!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>Untitled Document</title>
</head>
<body>
<p> </p>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
  <p> </p>
  <p> </p>
  <table align="center">
    <tr valign="baseline">
      <td nowrap="nowrap" align="right"> </td>
      <td align="center"><strong>แก้ไขข้อมูล</strong></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">ลำดับ:</td>
      <td><?php echo $row_Recordset1['ctm_id']; ?></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">ชื่อ:</td>
      <td><input type="text" name="ctm_name" value="<?php echo htmlentities($row_Recordset1['ctm_name'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">นามสกุล:</td>
      <td><input type="text" name="ctm_surname" value="<?php echo htmlentities($row_Recordset1['ctm_surname'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">ยี่ห้อมือถือ:</td>
      <td><select name="ctm_product" id="ctm_product">
<?php
			$strSQL = "SELECT * FROM add_product";
			$objQuery = mysql_query($strSQL);
			while($objResuut = mysql_fetch_array($objQuery))
			{
			?>
			
            <option value="<?=$objResuut["brand"];?>"><?=$objResuut["brand"];?></option>
			<?php
			}
			?>
		  </select></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">รุ่น:</td>
      
      <td>
		
		<select name="ctm_model" id="ctm_model">
		
			<?php
			$strSQL = "SELECT * FROM add_product";
			$objQuery = mysql_query($strSQL);
			while($objResuut = mysql_fetch_array($objQuery))
			{
			?>
			
            <option value="<?=$objResuut["model"];?>"><?=$objResuut["model"];?></option>
			<?php
			}
			?>
		  </select>
</td>
</tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">เบอร์ติดต่อ:</td>
      <td><input type="text" name="ctm_tel" value="<?php echo htmlentities($row_Recordset1['ctm_tel'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">วันที่มาซ่อม(ป-ด-ว):</td>
      <td><input type="text" name="ctm_date" value="<?php echo htmlentities($row_Recordset1['ctm_date'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">บริการที่เข้ารับ:</td>
      <td><select name="ctm_fix" id="ctm_fix">
<option value="case1">case1</option>
<option value="case2">case2</option>
<option value="case3">case3</option>
</select></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right"> </td>
      <td><center><input type="submit" value="เปลี่ยนแปลง" />
        <a href="data-table.php"><input type="button" name="cancel" id="cancel" value="ยกเลิก" /><a>
      </center></td>
    </tr>
  </table>
  <input type="hidden" name="MM_update" value="form1" />
  <input type="hidden" name="ctm_id" value="<?php echo $row_Recordset1['ctm_id']; ?>" />
</form>
<p> </p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($Recordset2);
?>
 
 
 Tag : PHP, MySQL
 
 
 |  
            |  |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2013-10-23 15:05:08 | By :
                          aorplus | View :
                          1042 | Reply :
                          7 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |  
		|  |  |  |  |  
  
    | 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ต้องทำความเข้าใจก่อนว่า ลำดับ กับ id มันต่างกันนะครับ - ลำดับคือจำนวนนับ
 - id คือค่าเฉพาะตัว
 
 // ส่งค่า $i ออกไปที่ get
 Code (PHP)
 
 mysql_select_db($database_AddDataCustomers, $AddDataCustomers);
$query_ShowData = "SELECT * FROM data_customers";
$ShowData = mysql_query($query_ShowData, $AddDataCustomers) or die(mysql_error());
$row_ShowData = mysql_fetch_assoc($ShowData);
$i=1;
$totalRows_ShowData = mysql_num_rows($ShowData);
?>
<!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>Untitled Document</title>
</head>
<body>
  <p> </p>
  <p> </p>
  <center>
    <p><b>ข้อมูลลูกค้าที่นำเครื่องมาซ่อม</b> </p>
    <p> </p>
</center>
  
<table width="1170" border="0" align="center">
  <tr>
    <td width="42" align="center" bgcolor="#00CC66"><strong>ลำดับ</strong></td>
    <td width="151" align="center" bgcolor="#00CC66"><strong>ชื่อ</strong></td>
    <td width="170" align="center" bgcolor="#00CC66"><strong>นามสกุล</strong></td>
    <td width="172" align="center" bgcolor="#00CC66"><strong>ยี่ห้อมือถือ</strong></td>
    <td width="127" align="center" bgcolor="#00CC66"><strong>รุ่น</strong></td>
    <td width="127" align="center" bgcolor="#00CC66"><strong>เบอร์ติดต่อ</strong></td>
    <td width="145" align="center" bgcolor="#00CC66"><strong>วันที่มาซ่อม</strong></td>
    <td width="132" align="center" bgcolor="#00CC66"><strong>บริการที่เข้ารับ</strong></td>
    <td colspan="2" align="center" bgcolor="#00CC66"><strong>ตัวเลือก</strong></td>
  </tr>
  <?php do { ;   ?>
    <tr>
      <td><?php echo $i++; ?></td>
      <td><?php echo $row_ShowData['ctm_name']; ?></td>
      <td><?php echo $row_ShowData['ctm_surname']; ?></td>
      <td><?php echo $row_ShowData['ctm_product']; ?></td>
      <td><?php echo $row_ShowData['ctm_model']; ?></td>
      <td><?php echo $row_ShowData['ctm_tel']; ?></td>
      <td><?php echo $row_ShowData['ctm_date']; ?></td>
      <td><?php echo $row_ShowData['ctm_fix']; ?></td>
      <td width="20" align="center"><a href="delete.php?ctm_id=<?php echo $row_ShowData['ctm_id']; ?>" onclick="return confirm('คุณแน่ใจที่จะลบ <?php echo $row_ShowData['ctm_name']; ?>');">ลบ</a></td>
      <td width="42" align="center"><a href="update.php?no=<?=$i;?>&ctm_id=<?php echo $row_ShowData['ctm_id']; ?>">แก้ไข</a></td>
    </tr>
    <?php   }   while ($row_ShowData = mysql_fetch_assoc($ShowData));  ?>
</table>
<p> </p>
 <center><form id="form1" name="form1" method="post" action="search.php">
   <label for="word"> ค้นหา :</label>
    <input type="text" name="word" id="word" />
    <input type="submit" name="btnsearch" id="btnsearch" value="Submit" />
  </form></center>
</body>
</html>
<?php
mysql_free_result($ShowData);
?>
 // รับค่า $_GET['no'];
 Code (PHP)
 
 <?php require_once('Connections/AddDataCustomers.php'); 
include("header.php");
mysql_query("SET NAMES UTF8");
?>
<?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_AddDataCustomers, $AddDataCustomers);
<?php require_once('Connections/AddDataCustomers.php'); ?>
<?php require_once('Connections/AddDataCustomers.php'); ?>
<?php require_once('Connections/AddDataCustomers.php');
include("header.php")
 ?>
<?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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE data_customers SET ctm_name=%s, ctm_surname=%s, ctm_product=%s, ctm_model=%s, ctm_tel=%s, ctm_date=%s, ctm_fix=%s WHERE ctm_id=%s",
                       GetSQLValueString($_POST['ctm_name'], "text"),
                       GetSQLValueString($_POST['ctm_surname'], "text"),
                       GetSQLValueString($_POST['ctm_product'], "text"),
					   GetSQLValueString($_POST['ctm_model'], "text"),
                       GetSQLValueString($_POST['ctm_tel'], "int"),
                       GetSQLValueString($_POST['ctm_date'], "date"),
                       GetSQLValueString($_POST['ctm_fix'], "text"),
                       GetSQLValueString($_POST['ctm_id'], "int"));
  mysql_select_db($database_AddDataCustomers, $AddDataCustomers);
  $Result1 = mysql_query($updateSQL, $AddDataCustomers) or die(mysql_error());
  $updateGoTo = "data-table.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}
$colname_Recordset1 = "-1";
if (isset($_GET['ctm_id'])) {
  $colname_Recordset1 = $_GET['ctm_id'];
}
mysql_select_db($database_AddDataCustomers, $AddDataCustomers);
$query_Recordset1 = sprintf("SELECT * FROM data_customers WHERE ctm_id = %s", GetSQLValueString($colname_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $AddDataCustomers) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$colname_Recordset2 = "-1";
if (isset($_GET['ctm_id'])) {
  $colname_Recordset2 = $_GET['ctm_id'];
}
mysql_select_db($database_AddDataCustomers, $AddDataCustomers);
$query_Recordset2 = sprintf("SELECT * FROM data_customers WHERE ctm_id = %s", GetSQLValueString($colname_Recordset2, "int"));
$Recordset2 = mysql_query($query_Recordset2, $AddDataCustomers) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<!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>Untitled Document</title>
</head>
<body>
<p> </p>
<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
  <p> </p>
  <p> </p>
  <table align="center">
    <tr valign="baseline">
      <td nowrap="nowrap" align="right"> </td>
      <td align="center"><strong>แก้ไขข้อมูล</strong></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">ลำดับ:</td>
      <td><?php echo $_GET['no']; ?></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">ชื่อ:</td>
      <td><input type="text" name="ctm_name" value="<?php echo htmlentities($row_Recordset1['ctm_name'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">นามสกุล:</td>
      <td><input type="text" name="ctm_surname" value="<?php echo htmlentities($row_Recordset1['ctm_surname'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">ยี่ห้อมือถือ:</td>
      <td><select name="ctm_product" id="ctm_product">
<?php
			$strSQL = "SELECT * FROM add_product";
			$objQuery = mysql_query($strSQL);
			while($objResuut = mysql_fetch_array($objQuery))
			{
			?>
			
            <option value="<?=$objResuut["brand"];?>"><?=$objResuut["brand"];?></option>
			<?php
			}
			?>
		  </select></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">รุ่น:</td>
      
      <td>
		
		<select name="ctm_model" id="ctm_model">
		
			<?php
			$strSQL = "SELECT * FROM add_product";
			$objQuery = mysql_query($strSQL);
			while($objResuut = mysql_fetch_array($objQuery))
			{
			?>
			
            <option value="<?=$objResuut["model"];?>"><?=$objResuut["model"];?></option>
			<?php
			}
			?>
		  </select>
</td>
</tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">เบอร์ติดต่อ:</td>
      <td><input type="text" name="ctm_tel" value="<?php echo htmlentities($row_Recordset1['ctm_tel'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">วันที่มาซ่อม(ป-ด-ว):</td>
      <td><input type="text" name="ctm_date" value="<?php echo htmlentities($row_Recordset1['ctm_date'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">บริการที่เข้ารับ:</td>
      <td><select name="ctm_fix" id="ctm_fix">
<option value="case1">case1</option>
<option value="case2">case2</option>
<option value="case3">case3</option>
</select></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right"> </td>
      <td><center><input type="submit" value="เปลี่ยนแปลง" />
        <a href="data-table.php"><input type="button" name="cancel" id="cancel" value="ยกเลิก" /><a>
      </center></td>
    </tr>
  </table>
  <input type="hidden" name="MM_update" value="form1" />
  <input type="hidden" name="ctm_id" value="<?php echo $row_Recordset1['ctm_id']; ?>" />
</form>
<p> </p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($Recordset2);
?>
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-10-23 15:12:58 | By :
                            Ex-[S]i[L]e[N]t |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | มันมาตามเลข ไอดี ของคุณไงครับ ถ้าอยากให้ตรงตามลำดับก้อสร้าง ฟิลด์อีกตัวนึงใน DB ให้เก็บ เลข ของ Record ให้รันเป็นแบบ auto increment  ไม่ต้องไป echo $i++ แต่ echo ฟิลด์ ที่เราสร้างมาใหม่ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-10-23 15:14:31 | By :
                            topza1412 |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | หรือทำตาม คุณ ☣ DÜd€ ☣ ก็ได้ครับ  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-10-23 15:17:36 | By :
                            topza1412 |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | ขอบคุณทั้งสองท่านมากค่ะสำหรับคำแนะนำ 
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-10-23 15:20:58 | By :
                            aorplus |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
        
          |  |  |  |  |  
          |  |  | 
            
              | คือพอเปลี่ยนแล้วมันขึ้นมาเป็นลำดับ 2 ค่ะ จากตอนแรกเป็นลำดับ 4 ก็ยังไม่ตรงกับตารางแสดงข้อมูล และใรฐานข้อมูลก็ยังเหมือนเดิมค่ะ 
 
  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-10-23 15:33:49 | By :
                            aorplus |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  
 
 
        
          |  |  |  |  |  
          |  |  | 
            
              | เย้ๆ ได้แล้วค่ะ 
 ขอบคุณมากๆเลยค่ะ
  
 |  
              | 
                
                  |  |  |  |  
                  |  | 
                      
                        | Date :
                            2013-10-24 13:48:57 | By :
                            aorplus |  |  |  
                  |  |  |  |  |  |  |  
          |  |  |  |  |  |  |