啊,明白了,我圖方便就簡寫了,沒按照規(guī)范,你就自己規(guī)范寫吧
創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站建設(shè)、成都做網(wǎng)站、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的鐵嶺縣網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
$cnt = select count(`id`) as `num` from `tablename` //這是取得數(shù)據(jù)庫內(nèi)的數(shù)據(jù)數(shù)量
$datas = select `id`, `picname`,`picpath` from `tablename`
兩種啊,第一種
foreach ( $datas as $data )
{
$del = "delete from `tablename` where `id`={$data['id']}";
@unlike( "{$data['picpath']}" );//這里取決于你存的是相對(duì)還是絕對(duì)路徑
echo("名稱:$data['picname']");//顯示文件名稱
echo("
html
head
script ...
function send_request()
{
//ajax發(fā)送查找數(shù)據(jù)庫請(qǐng)求
//設(shè)置onready函數(shù)等待數(shù)據(jù)接收完成
//當(dāng)數(shù)據(jù)接收完成,將div id="data_recv"/div之間的innerHtml設(shè)置為接受到的數(shù)據(jù)
//并顯示該div(初始化時(shí)設(shè)置為隱藏)
}
/script
/head
body
//搜索部分
div id="data_recv"
/div
/body
/html
......php文件
根據(jù)發(fā)送來的請(qǐng)求搜索數(shù)據(jù)庫,并生成相應(yīng)的 html,然后echo 之
while($row?=?mysql_fetch_row($rows)){
$rows[]?=?$row;
}
//遍歷$rows數(shù)組(二維數(shù)組),可以一次性輸出表格
html
head
title瀏覽表中記錄/title
/head
body
center
?php
$db_host=localhost; //MYSQL服務(wù)器名
$db_user=root; //MYSQL用戶名
$db_pass=""; //MYSQL用戶對(duì)應(yīng)密碼
$db_name="test"; //要操作的數(shù)據(jù)庫
//使用mysql_connect()函數(shù)對(duì)服務(wù)器進(jìn)行連接,如果出錯(cuò)返回相應(yīng)信息
$link=mysql_connect($db_host,$db_user,$db_pass)or die("不能連接到服務(wù)器".mysql_error());
mysql_select_db($db_name,$link); //選擇相應(yīng)的數(shù)據(jù)庫,這里選擇test庫
$sql="select * from test1"; //先執(zhí)行SQL語句顯示所有記錄以與插入后相比較
$result=mysql_query($sql,$link); //使用mysql_query()發(fā)送SQL請(qǐng)求
echo "當(dāng)前表中的記錄有:";
echo "table border=1"; //使用表格格式化數(shù)據(jù)
echo "trtdID/tdtd姓名/tdtd郵箱/tdtd電話/tdtd地址/td/tr";
while($row=mysql_fetch_array($result)) //遍歷SQL語句執(zhí)行結(jié)果把值賦給數(shù)組
{
echo "tr";
echo "td".$row[id]."/td"; //顯示ID
echo "td".$row[name]." /td"; //顯示姓名
echo "td".$row[mail]." /td"; //顯示郵箱
echo "td".$row[phone]." /td"; //顯示電話
echo "td".$row[address]." /td"; //顯示地址
echo "/tr";
}
echo "/table";
?
/center
/body
/html
這個(gè)簡單??!
首頁做個(gè)前臺(tái)輸入姓名和會(huì)員卡信息的頁面,我做個(gè)簡單的頁面給你看
!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會(huì)員查詢系統(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
然后我給你一個(gè)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);
?
頁面美化自己去搞!只能幫你這么多了
你的意思是說
點(diǎn)擊查詢后
要吧與關(guān)鍵字相關(guān)聯(lián)的整條記錄都顯示出來?
那樣的話
你要先把這條記錄復(fù)制
給某個(gè)數(shù)組,然后輸出這個(gè)數(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];
……
網(wǎng)站名稱:php顯示數(shù)據(jù)庫表記錄 php顯示mysql中的數(shù)據(jù)
轉(zhuǎn)載注明:http://chinadenli.net/article24/hpegce.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站、ChatGPT、品牌網(wǎng)站制作、關(guān)鍵詞優(yōu)化、網(wǎng)站策劃、面包屑導(dǎo)航
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)