เรียงลำดับตัวเลขในหน้าค้นหา ช่วยดูให้หน่อยนะคะ

ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา เรียงลำดับตัวเลขในหน้าค้นหา ช่วยดูให้หน่อยนะคะ

เรียงลำดับตัวเลขในหน้าค้นหา ช่วยดูให้หน่อยนะคะ
อยากเรียงลำดับเลขที่บัญชีค่ะ เรียงจากน้อยไปหามาก 
<?php require_once('../Connections/Myconnect.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;
}
}

$colname_Recordset1 = "-1";
if (isset($_GET['idcard'])) {
  $colname_Recordset1 = $_GET['idcard'];
}
mysql_select_db($database_Myconnect, $Myconnect);
$query_Recordset1 = sprintf("SELECT * FROM customer WHERE idcard = %s", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $Myconnect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!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>search_user</title>
</head>

<body background="bg.jpg" >
<?php require('topmenu.css');?>
<script language="JavaScript">
	function onDelete()
	{
		if(confirm('Do you want to delete ?')==true)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
</script>
<form name="frmMain" action="search_user.php" method="post" OnSubmit="return onDelete();">
<center>
<br />
  <table width="1229" height="152" border="0">
  <tr>
    <td width="1223" height="135"  border="0"><center>
      <img src="GSB_Logo.png" width="452" height="158" />
    </center></td>
  </tr>
  </table>
   
  <table width="1228" height="31" border="0">
    <tr>
      <td width="705" height="25" >
        <font color="#FFFFFF"> <form action=" " method="post"  autocomplete="on">
        <div id="headBottom">
         
<div id="topmenu">
  <ul>
    <li><a href="index_user.php"><span>หน้าแรก</span></a> 
        <a href="Account Summary.php"><span>เพิ่มบัญชีลูกค้า</span></a> 
        <a href="edit account.php"><span>แก้ไขบัญชีลูกค้า</span></a> 
        <a href="search_user.php"><span>ค้นหาแฟ้มงาน</span></a> 
        <a href="seeall_user.php"><span>ดูแฟ้มงานทั้งหมด</span></a> 
        <a href="contact.php"><span>แก้ไขข้อมูลส่วนตัว</span></a> 
        </li>
  </ul>
</div>
<div class="bttnCheck"></div>
        </div>
      </form><font color="#333333">
        <div align="right" size="16">ยินดีต้อนรับ:<font color="#6633CC"><? echo $_SESSION["user"];?></font>&nbsp;<a href="login.php">Logout</a></div>
        </tr>
    </td></table>
  
  <table width="1234" border="0">
    <tr>
      <td height="407" align="center" valign="top" bgcolor="#FFFFFF">
      
      <br />
      <table width="1228" border="0">
        <tr>
          <td width="1234" height="407" align="center" valign="top" bgcolor="#FFFFFF"><center>
            <p>
              <?  if($submit=="" or $show=="OK"){?>
              <center>
            </p>
            <center>
              <form action="search_user.php?show=OK&amp;strSearch=Y" method="post" name="form1" id="form1">
                <table width="98%" >
                  <tr>
                    <td width="50%"><div align="right">ค้นหา :
                      <select name="Search2">
                        <option value="n_credit" <? if($Search2=="n_credit"){ ?>selected<? }?>>ประเภทสินเชื่อ</option>
                        <option value="id_credit" <? if($Search2=="id_credit"){ ?>selected<? }?>>เลขที่บัญชี</option>
                        <option value="idcard" <? if($Search2=="idcard"){ ?>selected<? }?>>เลขบัตรประชาชน</option>
                        <option value="name" <? if($Search2=="name"){ ?>selected<? }?>>ชื่อ</option>
                      </select>
                    </div></td>
                    <td width="64%"><input name="Search" type="text" size="20" value="<? echo $Search?>"onfocus="this.value = '';" />
                      <input type="submit" name="submit" value="Search" /></td>
                  </tr>
                </table>
              </form>
            </center>
            <p>
              <?
if(!isset($start)){
$start = 0;
$page=1;
}
$limit = '10';

if($strSearch=="Y"){
$Qtotal = mysql_query("select * from customer Where ".$Search2." like '%".$Search."%'  ");
}else{
$Qtotal = mysql_query("select * from customer");
}

$total = mysql_num_rows($Qtotal); 
if($strSearch=="Y"){
$Query = mysql_query("select * from customer Where ".$Search2." like '%".$Search."%'   order  by  id_credit DESC LIMIT $start,$limit");
}else{
$Query= mysql_query("select * from customer order  by id_credit DESC LIMIT $start,$limit");
}

echo "ระบบสารสนเทศการติดตามหนี้ของแผนกสินเชื่อ  ธนาคารออมสิน  สาขาปฐมพร";

$totalp = mysql_num_rows($Query)==0;
$xx=$totalp+$start;
$yy=$start+1;

?>
              <br />
            </p>
            <table width="79%" height="60">
              <tr bgcolor="#666699" height='40' >
                <td width="16%" align='center'><strong><font color="#FFFFFF">ประเภทสินเชื่อ</font></strong></td>
                <td width="15%" align='center'><strong><font color="#FFFFFF">เลขที่บัญชี</font></strong></td>
                <td width="17%" align='center'><strong><font color="#FFFFFF">เลขบัตรประชาชน</font></strong></td>
                <td width="11%" align='center'><strong><font color="#FFFFFF">คำนำหน้าชื่อ</font></strong></td>
                <td width="19%" align='center'><strong><font color="#FFFFFF">ชื่อ</font></strong></td>
                <td width="16%" align='center'><strong><font color="#FFFFFF">นามสกุล</font></strong></td>
                <td width="6%" align='center'><strong><font color="#FFFFFF">รายงาน</font></strong></td>
              </tr>
              <?
while($arr = mysql_fetch_array($Query)){
$autoid = $arr['id_credit'];
$i++;
if($i%2==0){
$bg = "#CCCCCC";
}else{
$bg = "#CCCCCC";
}
?>
              <tr bgcolor="<? echo $bg?>" onmouseover="this.style.backgroundColor='#BEBEE9'" onmouseout="this.style.backgroundColor=''" valign="top">
                <td align='left' valign="middle"><? echo $arr['n_credit'] ?></td>
                <td align='center' valign="middle"><? echo $arr['id_credit'] ?></td>
                <td align='center' valign="middle"><? echo $arr['idcard'] ?></td>
                <td align='center' valign="middle"><? echo $arr['titlename'] ?></td>
                <td align='center' valign="middle"><? echo $arr['name'] ?></td>
                <td width="16%" align='center' valign="middle"><? echo $arr['lastname'] ?></td>
                <td width="6%" align='left' valign="middle" bgcolor="#FFFFFF"><a href="report.php?id_credit=<?php echo $arr['id_credit']; ?>" ><img src="report.png" width="37" height="28" /></td>
              </tr>
              <? }?>
             
            </table>
            <p>
              <? }?>
              
            </p>
            <p> <input name="input" type="button" value="สั่งพิมพ์" onclick="window.print();" />
            </p>
          </center></td>
        </tr>
      </table>
      <table width="1225" height="31" border="0">
    <tr>
      <td width="1226" height="1" bgcolor="#6666CC">
      </td>
    </tr>
  </table>
      </body>
</html>
<?php
mysql_free_result($Recordset1);
?>


Only 1.47.2.xxx 09-01-2015 09:16:59

คำแนะนำ และการใช้งาน

สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก


  • ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
  • เปลี่ยน


    ( หรือ เข้าใช้งานผ่าน Social Login )

 ความคิดเห็นที่ 1
DESC  คือจากมากไปหาน้อย ตัดออก ก็จะเป็นจากน้อยไปหามาก


ninenik 171.96.13.xxx 09-01-2015






เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ