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,028

HOME > PHP > PHP Forum > ขอ code ค้นหา ค้นหา ใน คอลัมถ์ A กดปุ่มค้นหา แล้ว page เปิดขั้นมาตาม url คอลัมภ์ B



 

ขอ code ค้นหา ค้นหา ใน คอลัมถ์ A กดปุ่มค้นหา แล้ว page เปิดขั้นมาตาม url คอลัมภ์ B

 



Topic : 035227



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



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




อยากได้ code ค้นหาข้อมูล แล้ว page เปิดขึ้นมา

คอลัมภ์ A มีข้อมูล aaaa, bbbb, ccc
คอลัมภ์ B มีข้อมูล a.htm , b.htm , c.htm



ค้นหา ใน คอลัมถ์ A กดปุ่มค้นหา แล้ว page เปิดขั้นมาตาม url คอลัมภ์ B



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2009-12-03 01:28:52 By : koelso View : 1811 Reply : 3
 

 

No. 1



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

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

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

ขอรายละเอียดให้ชัดเจนกว่านี้หน่อยครับ เพราะถามแบบนี้โอกาสมีคนตอบน้อยครับ






Date : 2009-12-03 01:33:24 By : xbeginner01
 


 

No. 2



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



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


เอานี่โค้ดนี่ไปเป็นแนวทางละกันนะคับบ
ผมก้อศึกษาอยุ่อ่า

////////// search.php /////////////////


<!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>
<?
// เชื่อมต่อฐานข้อมูล
$host="localhost"; // กำหนด host
$username="root"; // กำหนด username
$pass_word="nuiii"; // กำหนด Password
$db="test_create_database"; // กำหนดชื่อฐานข้อมูล
$Conn = mysql_connect( $host,$username,$pass_word) or die ("ติดต่อฐานข้อมูลไม่ได้");// ติดต่อฐานข้อมูล
mysql_query("SET NAMES utf8",$Conn); // set กำหนดมาตราฐาน
mysql_select_db($db) or die("เลือกฐานข้อมูลไม่ได้"); // เลือกฐานข้อมูล
//--->
?>
<form id="form1" name="form1" method="post" action="search.php">
ค้นหา <input name="txt_search" type="text" value="<?=$_POST['txt_search']?>" /> <input name="Search" type="submit" value="ค้นหา" />
</form>
<table width="600" border="1" cellspacing="2" cellpadding="2">
<tr>
<td><div align="center">รหัส</div></td>
<td><div align="center">ชื่อ</div></td>
<td><div align="center">นามสกุล</div></td>
<td><div align="center">ที่อยู่</div></td>
<td><div align="center">โทรศัพท์</div></td>
<td><div align="center">แก้ไข</div></td>
</tr>
<?
$sql_show = "select * from customer";
if($_POST['Search'])
{
$txt_search = $_POST['txt_search'];
$sql_show.=" where name like '%$txt_search%' or surname like '%$txt_search%' ";
}
$result_show = mysql_query($sql_show) or die(mysql_error());
while($row_show = mysql_fetch_array($result_show))
{
?>
<tr>
<td><?=$row_show['id']?></td>
<td><?=$row_show['name']?></td>
<td><?=$row_show['surname']?></td>
<td><?=$row_show['address']?></td>
<td><?=$row_show['phone']?></td>
<td><div align="center"><a href="edit.php?edit_id=<?=$row_show[id]?>">แก้ไข</a></div></td>
</tr>
<?
}
?>
</table>
</body>
</html>
Date : 2009-12-06 17:04:38 By : dootertam
 

 

No. 3



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



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

search.php


<?php require_once('Connections/connect.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;
}
}

mysql_select_db($database_connect, $connect);
$query_SearchByType = "SELECT * FROM type ORDER BY name_type ASC";
$SearchByType = mysql_query($query_SearchByType, $connect) or die(mysql_error());
$row_SearchByType = mysql_fetch_assoc($SearchByType);
$totalRows_SearchByType = mysql_num_rows($SearchByType);
?>
<!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>หน้าแรก</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
}
a:link {
color: #F06;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #F06;
}
a:hover {
text-decoration: none;
color: #F3C;
}
a:active {
text-decoration: none;
color: #00F;
}
-->
</style></head>

<body>
<?php include('scipt_function.html')?>
<table width="921" height="749" border="0" align="center">
<tr>
<td height="272" colspan="2" valign="top" bgcolor="#FFCCFF"><?php include('headone.php'); ?></td>
</tr>
<tr >
<td width="213" height="395" bgcolor="#FFCCCC" align="center" valign="top"><table width="100%" border="0" cellspacing="2">
<tr>
<td><form id="form3" name="form3" method="post" action="search.php">
<p align="center">ค้นหาสินค้า</p>
<p>
<label>
<input type="text" name="txtSearch" value="<?=$_POST['txtSearch'];?>"/>
</label>
<label>
<input type="submit" name="button2" id="button2" value="Submit" />
</label>
</p>
</form></td>
</tr>
</table>
<p> </p>
<table width="213" height="192" border="1" bordercolor="#FF3333" align="center" cellspacing="2">
<tr>
<td>
<form id="form1" name="form1" method="post" action="chkmember.php">
<table width="200" border="0" cellspacing="2">
<tr>
<td width="72">username :</td>
<td width="118"><label>
<input name="user_login" type="text" id="textfield" size="20" onkeypress="Checktext()"/>
</label></td>
</tr>
<tr>
<td>password :</td>
<td><label>
<input name="pass_login" type="password" id="textfield2" size="20" />
</label></td>
</tr>
<tr>
<td colspan="2" align="center"><label>
<input type="submit" name="button" id="button" value="เข้าสู่ระบบ" />
|
<a href="user/m_forgetpassword.php">ลืมรหัสผ่าน</a> </label></td>
</tr>
</table>
</form>
<p align="center"><a href="register.php">สมัครสมาชิกใหม่</a></p>
<p align="center"><a href="admin_login.php">สำหรับผู้ดูแลระบบ</a></p></td>
</tr>
</table>
<br />
<table width="213" height="138" border="0" bordercolor="#FF6633" cellspacing="2" align="center">
<tr align="center" bgcolor="#FF0000" >
<td bgcolor="#FFFFCC"><? include('calander.php')?></td>
</tr>
</table></td>
<td width="828" align="center" valign="top" bgcolor="#FFFFCC">
<form id="form2" name="form2" method="post" action="">
<table width="80%" height="342" border="0" align="center" cellspacing="2">
<tr>
<td align="center" valign="top"><h3> </h3>
<!--ค้นหา-->
<?php
include('user/connect.php');
$sql_show = "select * from products";
if($_POST['txtSearch'])
{
$txtSearch=$_POST['txtSearch'];
$sql_show.=" where name_prd like '%txtSearch%'";
}
$result_show = mysql_query($sql_show) or die(mysql_error());
while($row_show = mysql_fetch_array($result_show)){;

$id_prd=$rs[id_prd];
$code=sprintf("%05d",$id_prd);
$name_prd=$rs[name_prd];
$detail_prd=$rs[detail_prd];
$ref_id_type=$rs[ref_id_type];
$price_prd=$rs[price_prd];
$photo_prd=$rs[photo_prd];
$amount=$rs[amount];
$price_send=$rs[price_send];

if ($photo_prd==""){
$photo_prd="picweb/temp.jpg.jpg";
}

echo"
<table border='2'>
<tr bordercolor='#FF9900'>
<td width='30%' valign='top'>
<img width='180' src='$photo_prd'>
</td>
<td width='70%'>
<b>รหัสสินค้า :</b>$code<br>
<b>ประเภทสินค้า :</b>$ref_id_type<br>
<b>ชื่อสินค้า :</b>$name_prd<br>
<b>ราคาสินค้า :</b><samp>".number_format($price_prd,2,'.',',')."</samp>บาท<br><br>
[<a href='view_pro.php?id_prd=$id_prd'>ดูรายละเอียด</a>]
<br>
</td>
</tr>
</table>";
}//end while
?>

</td>
</tr>
<tr bgcolor="#FFCC66" align="center">
<td height="72" align="center"><table width="100%" border="0" align="center" cellspacing="2">
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td width="100%" colspan="3" valign="top" bgcolor="#FFCC66"><div align="center"><strong><font color="#FF6633">HAND MADE KIKUYA<br>
Contact Us :</font></strong><strong><font color="#FF6633">Jutamat Sangka & Sompit Poomtong</font></strong><br>
</div>
</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($SearchByType);
?>
=============================================

พอรันแล้วมันบอกว่า No Database selected

=============================================

อันนี้ Cn.php

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_connect = "localhost";
$database_connect = "project";
$username_connect = "root";
$password_connect = "102bc17sau";
$connect = mysql_pconnect($hostname_connect, $username_connect, $password_connect) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_query("SET NAMES utf8");
?>

==================================
ช่วยดูให้หน่อยค่ะ ผิดตรงไหน
Date : 2012-03-03 01:29:42 By : จุฑามาศ
 

   

ค้นหาข้อมูล


   
 

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