php表格形式展示數(shù)據(jù) php的table

php怎么把數(shù)據(jù)庫(kù)中的數(shù)據(jù)顯示成表格

用table/table就可以了啊,然后用PHP的逐條輸出數(shù)據(jù)語(yǔ)句相結(jié)合,你圖太小,根本看不清,不過(guò)道理就是這么個(gè)道理的

站在用戶的角度思考問(wèn)題,與客戶深入溝通,找到清河網(wǎng)站設(shè)計(jì)與清河網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶體驗(yàn)好的作品,建站類型包括:網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、國(guó)際域名空間、網(wǎng)站空間、企業(yè)郵箱。業(yè)務(wù)覆蓋清河地區(qū)。

php用表單形式顯示數(shù)據(jù)庫(kù)信息

初學(xué)者寫(xiě)的,你可以試試

form?name="myform"?method="post"?action="mysql.php"

table?border="1"

tr

td?width="605"?height="51"?bgcolor="#CC99FF"?colspan="2"

div?align="center"請(qǐng)輸入用戶名稱

input?name="txt_user"?type="text"?id="txt_user"?size="25"nbsp;

input?type="submit"?name="Submit"?value="查詢"

/div

/td

/tr

tr

td?align='center'用戶名稱/td

td?align='center'年齡/td

/tr

?php

//?mysql_connect(服務(wù)器,用戶名,密碼)

$link?=?mysql_connect("localhost","root","root");

//?mysql_select_db(數(shù)據(jù)庫(kù),$link)

$db_selected?=?mysql_select_db("php_test",$link);

//?編碼格式(貌似很重要)

mysql_query("set?names?'utf8'");

?

?php

$sql?=?mysql_query("select?name_,age_?from?t_user");

$info?=?mysql_fetch_array($sql);

if($_POST[Submit]=="查詢"){

$txt_user?=?$_POST[txt_user];

$sql?=?mysql_query("select?*?from?t_user?where?name_?like?'%".trim($txt_user)."%'");

$info?=?mysql_fetch_array($sql);

}

?

?php

if($info==false){

echo?'trtd?width="605"?height="51"?bgcolor="#CC99FF"?colspan="2"';

echo?"div?align='center'?style='color:#FF0000;font-size:12px;'對(duì)不起,您查找的用戶信息不存在!/div";

echo?'/td/tr';

}elseif($info){

echo?'elseif';

}

?

?php

do{

?

tr?align="center"?bgcolor="#FFFFFF"

td?height="20"align="center"??php?echo?$info['NAME_']?/td

td??php?echo?$info['AGE_']?/td

/tr

?php

}while($info?=?mysql_fetch_array($sql));

mysql_free_result($sql);

mysql_close($link);

?

/table

/form

php連接數(shù)據(jù)庫(kù)并顯示指定的數(shù)據(jù),就是以表格的形式輸出的,求代碼解析

主要的寫(xiě)出來(lái)啊

$query="select

*

from

student

where

id=01";

$res=my_sql_query($query);

$date=array();//保存得到的數(shù)據(jù)

where($row=mysql_fetch_assoc($res)){

$date=$row['填寫(xiě)你表的字段'];

}

下面循環(huán)遍歷$date輸出到table就可以了啊

分享名稱:php表格形式展示數(shù)據(jù) php的table
文章分享:http://muchs.cn/article36/dosjgpg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供全網(wǎng)營(yíng)銷(xiāo)推廣網(wǎng)站導(dǎo)航、網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)網(wǎng)站內(nèi)鏈

廣告

聲明:本網(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í)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)