十年網(wǎng)站開發(fā)經(jīng)驗(yàn) + 多家企業(yè)客戶 + 靠譜的建站團(tuán)隊(duì)
量身定制 + 運(yùn)營維護(hù)+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
form action="" method="get"
成都創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的通化縣網(wǎng)站設(shè)計(jì)、移動媒體設(shè)計(jì)的需求,幫助企業(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']}";
//手機(jī)打的沒測試過,應(yīng)該沒什么問題
?
我的做法:
每個按鈕的鏈接參數(shù)不一樣
例如 index.php?sta=1 //開放投標(biāo)
index.php?sta=2 //流標(biāo)
程序端獲取get值在
switch($_GET['sta']){
case 1:
$data = ""; //查投標(biāo)的數(shù)據(jù)
break;
case 2:
$data = "";//查流標(biāo)的數(shù)據(jù)
break
}
這樣只要控制后sql就可以按需求查詢出結(jié)果了
你的意思是說
點(diǎn)擊查詢后
要吧與關(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];
……
剛進(jìn)入頁面是select * from table
頁面是 select * from table where username=小文
搜索20多個頁面?沒搞明白這點(diǎn)說的是什么。
一般的搜索功能,只不過是點(diǎn)查詢時,把關(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%'";
這個簡單?。?/p>
首頁做個前臺輸入姓名和會員卡信息的頁面,我做個簡單的頁面給你看
!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);
?
頁面美化自己去搞!只能幫你這么多了