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 : 073789

Guest




การสร้างระบบค้นหาและแสดงข้อมูล

..

..


โค้ดรูปที่1

Code (PHP)
<body>
<form id="fmsearch" name="fmsearch" method="get" action="result.php">
  <table width="279" border="1">
    <tr>
      <td width="158"><input type="text" name=" txtName " id=" txtName " /></td>
      <td width="105"><input type="submit" name="Submit" id="Submit" value="ค้นหา" /></td>
    </tr>
  </table>
</form>
</body>  


โค้ดรูปที่2

Code (PHP)
<?php require_once('Connections/dbcon.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $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_rsResult = 5;
$pageNum_rsResult = 0;
if (isset($_GET['pageNum_rsResult'])) {
  $pageNum_rsResult = $_GET['pageNum_rsResult'];
}
$startRow_rsResult = $pageNum_rsResult * $maxRows_rsResult;

$colname_rsResult = "-1";
if (isset($_GET[' txtName '])) {
  $colname_rsResult = $_GET[' txtName '];
}
mysql_select_db($database_dbcon, $dbcon);
$query_rsResult = sprintf("SELECT * FROM rawmaterial WHERE name_m LIKE %s ORDER BY name_m ASC", GetSQLValueString("%" . $colname_rsResult . "%", "text"));
$query_limit_rsResult = sprintf("%s LIMIT %d, %d", $query_rsResult, $startRow_rsResult, $maxRows_rsResult);
$rsResult = mysql_query($query_limit_rsResult, $dbcon) or die(mysql_error());
$row_rsResult = mysql_fetch_assoc($rsResult);

if (isset($_GET['totalRows_rsResult'])) {
  $totalRows_rsResult = $_GET['totalRows_rsResult'];
} else {
  $all_rsResult = mysql_query($query_rsResult);
  $totalRows_rsResult = mysql_num_rows($all_rsResult);
}
$totalPages_rsResult = ceil($totalRows_rsResult/$maxRows_rsResult)-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=windows-874" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style4 {	font-family: "TX Melittin";
	font-size: 16px;
}
-->
</style>
</head>

<body>
<table width="464" border="1">
  <tr>
    <td width="72">เลข</td>
    <td width="376">ชื่อ</td>
  </tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_rsResult['id']; ?></td>
      <td><?php echo $row_rsResult['name_m']; ?></td>
    </tr>
    <?php } while ($row_rsResult = mysql_fetch_assoc($rsResult)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($rsResult);
?>




ข้อมูลไม่แสดงคับช่วยชี้แนะด้วย



Tag : PHP, JavaScript







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-02-14 00:18:19 By : หัดเล่น View : 996 Reply : 1
 

 

No. 1



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

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

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


PHP MySQL Search Record






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-02-14 01:40:38 By : ikikkok
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
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 00
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 อัตราราคา คลิกที่นี่