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 > ช่วยตรวจสอบหน่อยครับ ผมทำหน้าค้นหาแล้วแสดงอีกหน้านึง แต่ข้อมูลแสดงออกมา Record เดียวทั้งๆที่ใน DB มีข้อมูลนี้มากกว่า 1 record



 

ช่วยตรวจสอบหน่อยครับ ผมทำหน้าค้นหาแล้วแสดงอีกหน้านึง แต่ข้อมูลแสดงออกมา Record เดียวทั้งๆที่ใน DB มีข้อมูลนี้มากกว่า 1 record

 



Topic : 127146



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



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




ช่วยตรวจสอบหน่อยครับ ผมทำหน้าค้นหาแล้วแสดงอีกหน้านึง แต่ข้อมูลแสดงออกมา Record เดียวทั้งๆที่ใน DB มีข้อมูลนี้มากกว่า 1 record

Code (PHP)
<?php require_once('Connections/IT.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;
}
}

$currentPage = $_SERVER["PHP_SELF"];

$colname_Search = "-1";
if (isset($_POST['search'])) {
  $colname_Search = $_POST['search'];
}
mysql_select_db($database_IT, $IT);
$query_Search = sprintf("SELECT * FROM addjob WHERE req_name LIKE %s ORDER BY id DESC", GetSQLValueString("%" . $colname_Search . "%", "text"));
$Search = mysql_query($query_Search, $IT) or die(mysql_error());
$row_Search = mysql_fetch_assoc($Search);
$totalRows_Search = mysql_num_rows($Search);

$queryString_Search = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Search") == false && 
        stristr($param, "totalRows_Search") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Search = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Search = sprintf("&totalRows_Search=%d%s", $totalRows_Search, $queryString_Search);
?>
<!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 charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
<title>หน้าหลัก</title>
<link rel="stylesheet" href="css/jquery-ui.css">
<script src="js/jquery-1.10.2.js"></script>
<script src="js/jquery-ui.js"></script>
<script>
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];}
}
</script>
</head>

<body background="images/1180422460.gif" onload="MM_preloadImages('icon/Back1.png')">
<table width="100%" border="1">
  <tr>
    <td class="btn-success">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="icon/Tools.png" width="32" height="32" /> &nbsp;<strong>ระบบแจ้ง LMS</strong></td>
    <td width="7%" height="43" class="btn-success">&nbsp;&nbsp;&nbsp;</td>
  </tr>
</table>
  <p>
    <script src="js/bootstrap.min.js"></script>
    <marquee bgcolor="#39b54a" border="0" align="middle" scrollamount="2"  scrolldelay="5" behavior="scroll"  width="100%" height="20" style="font-family: Arial, Helvetica, sans-serif; color: #FFFFFF; font-size: 18">
    ** รายการค้นหาใบงาน **
    </marquee>
  <br>
  <p>
  <p>  
  <table width="100%" border="0">
    <tr>
      <td width="7%">&nbsp;</td>
      <td width="33%"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','icon/Back1.png',1)"><strong><img src="icon/Back.png" name="Image4" width="32" height="32" border="0" id="Image4" /> กลับหน้าหลัก</strong></a></td>
      <td width="60%"><img src="icon/Help.png" width="32" height="32" /> <strong>ใบงาน &nbsp;<?php echo $row_Search['req_name']; ?></strong></td>
    </tr>
</table>

<table width="100%" border="0" class="table table-bordered">
  <tr class="btn-success">
    <td width="8%" align="center"><strong>ชื่อผู้แจ้ง</strong></td>
   	<td width="8%" align="center"><strong>ชื่อเซลล์</strong></td>
    <td width="8%" align="center"><strong>วันที่คีย์</strong></td>
    <td width="8%" align="center"><strong>วันที่ส่ง</strong></td>
    <td width="8%" align="center"><strong>ประเภทงาน</strong></td>
    <td width="8%" align="center"><strong>ชื่อลูกค้า</strong></td>
    <td width="8%" align="center"><strong>ที่อยู่</strong></td>
    <td width="8%" align="center"><strong>รายละเอียดสินค้า</strong></td>
    <td width="8%" align="center"><strong>จำนวน</strong></td>
    <td width="8%" align="center"><strong>สถานะ</strong></td>

  </tr>
  
    <tr>
      <td><?php echo $row_Search['req_name']; ?></td>
      <td><?php echo $row_Search['req_name']; ?></td>
      <td><?php echo $row_Search['req_date']; ?></td>
      <td><?php echo $row_Search['rec_date']; ?> : <?php echo $row_Search['rec_time']; ?> </td>
      <td><?php echo $row_Search['rec_jobtype']; ?></td>
      <td><?php echo $row_Search['rec_name']; ?></td>
      <td><?php echo $row_Search['rec_location']; ?></td>
      <td><?php echo $row_Search['rec_detail']; ?></td>
      <td><?php echo $row_Search['rec_qty']; ?></td>
      <td><?php echo $row_Search['status']; ?></td>
    </tr>
</table>

</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($Search);
?>





Tag : PHP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2017-04-10 00:13:19 By : karurub View : 546 Reply : 1
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

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

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

=> PHP MySQL Search Record

Dreamweaver มีแต่ Code ขยะครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-04-10 06:16:35 By : mr.win
 

   

ค้นหาข้อมูล


   
 

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