form action="" method="get"

成都創(chuàng)新互聯(lián)堅持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站設(shè)計、成都網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的通化縣網(wǎng)站設(shè)計、移動媒體設(shè)計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
請輸入ID號:input type="text" name="word" /
input type="submit" value="查詢" /
/form
?php
if(!($_GET["word"])){
exit();//沒有數(shù)據(jù)
}
mysql_connect("127.0.0.1",用戶名,密碼);
$sql="use fenzu
select * from think_user
where id={$_GET['word']}
";
$rs=mysql_query($sql);
$num=mysql_num_rows($rs);
//獲取影響行數(shù),0表示沒查到
if(!($num)){
echo '數(shù)據(jù)不存在!';
}
$row=mysql_fetch_array($rs);//如果有多條數(shù)據(jù)請用循環(huán)
echo "id:{$row['id']}";
echo "名字:{$row['name']}";
echo "時間:{$row['time']}";
//手機打的沒測試過,應(yīng)該沒什么問題
?
我的做法:
每個按鈕的鏈接參數(shù)不一樣
例如 index.php?sta=1 //開放投標
index.php?sta=2 //流標
程序端獲取get值在
switch($_GET['sta']){
case 1:
$data = ""; //查投標的數(shù)據(jù)
break;
case 2:
$data = "";//查流標的數(shù)據(jù)
break
}
這樣只要控制后sql就可以按需求查詢出結(jié)果了
你的意思是說
點擊查詢后
要吧與關(guān)鍵字相關(guān)聯(lián)的整條記錄都顯示出來?
那樣的話
你要先把這條記錄復(fù)制
給某個數(shù)組,然后輸出這個數(shù)組就可以了
$sql="select
*
from
db1
where
name=$_post[name]";
$result=mysql_query($sql,$con);
$row=mysql_fetch_array($result)
echo
$row[name];
echo
$row[age];
……
剛進入頁面是select * from table
頁面是 select * from table where username=小文
搜索20多個頁面?沒搞明白這點說的是什么。
一般的搜索功能,只不過是點查詢時,把關(guān)鍵詞以url參數(shù)形式發(fā)給php,然后php從數(shù)據(jù)庫中選擇相應(yīng)的內(nèi)容顯示出來。
//js,你還可以添加一些判斷,比如關(guān)鍵字輸入是否合法之類
$('#btn').click(function(){
location.href='search.php?keyword='+$('#keyword').val()
});
//php
$keyword=$_GET['keyword'];
$sql="select?*?from?myTable?where?title?like?'%$keyword%'";
這個簡單啊!
首頁做個前臺輸入姓名和會員卡信息的頁面,我做個簡單的頁面給你看
!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?"
html?xmlns="
head
meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8"?/
title會員查詢系統(tǒng)/title
/head
body
form?id="form1"?name="form1"?method="post"?action="test.php"
p
label?for="name"/label
input?type="text"?name="name"?id="name"?/
/p
p
label?for="vipid"/label
input?type="text"?name="vipid"?id="vipid"?/
/p
p
input?type="submit"?name="button"?id="button"?value="查詢"?/
/p
/form
/body
/html
然后我給你一個test.php的文件代碼:
?php
$name????=????trim($_POST['name']);
$vipid????=????trim($_POST['vipid']);
$con?=?mysql_connect("127.0.0.1","數(shù)據(jù)庫用戶名","數(shù)據(jù)庫密碼");
if?(!$con)
{
die('Could?not?connect:?'?.?mysql_error());
}
$a????=????mysql_select_db("數(shù)據(jù)庫名字",?$con);
$sql????=????"select?*?from?kh_customer?where?name?=?'$name'?and?vipid?=?'$vipid'";
$result?=?mysql_query($sql);
while($row?=?mysql_fetch_array($result))
{
echo?$row['name']?.?"?"?.?$row['data'];
echo?"br?/";
}
mysql_close($con);
?
頁面美化自己去搞!只能幫你這么多了
本文題目:php點擊按鈕查詢數(shù)據(jù) php查詢功能
瀏覽地址:http://chinadenli.net/article10/hipjgo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計公司、網(wǎng)站建設(shè)、搜索引擎優(yōu)化、建站公司、網(wǎng)站策劃、做網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)