十年網站開發(fā)經驗 + 多家企業(yè)客戶 + 靠譜的建站團隊
量身定制 + 運營維護+專業(yè)推廣+無憂售后,網站問題一站解決
主要的寫出來啊
專注于為中小企業(yè)提供成都網站制作、做網站服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)汝州免費做網站提供優(yōu)質的服務。我們立足成都,凝聚了一批互聯(lián)網行業(yè)人才,有力地推動了上1000家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網站建設實現(xiàn)規(guī)模擴充和轉變。
$query="select
*
from
student
where
id=01";
$res=my_sql_query($query);
$date=array();//保存得到的數(shù)據(jù)
where($row=mysql_fetch_assoc($res)){
$date=$row['填寫你表的字段'];
}
下面循環(huán)遍歷$date輸出到table就可以了啊
你是什么數(shù)據(jù)庫,不同數(shù)據(jù)庫調用方法也不同,比如mysql,一般寫法,
?php
$link=mysql_connect("localhost","root","root");//連接數(shù)據(jù)庫
mysql_select_db("庫名");//選擇庫
$sql="select?name,sex,age?from?user";
$rs=mysql_query($sql);
while($row=mysql_fetch_object($rs)){?
trtd?php?echo?$row['name']?/tdtd?php?echo?$row['sex']?/tdtd?php?echo?$row['age']?/td/tr
?php?}?
不要用 \t 制表符。
用tabletrtd/td/tr/table
?php?
header("Content-type:application/vnd.ms-excel");??//excel頭信息
header("Content-Disposition:attachment;filename=test_data.xls");
?
table?class="table"?border="1"
thead
tr
th編號:?/th
th門店?/th
th手機號碼?/th
/tr
/thead
tbody
?php?
//數(shù)據(jù)庫查詢?
$dosql-Execute("select?*?from?link_log??order?by?id?desc");
$i=$dosql-GetTotalRow();
while($result=$dosql-GetArray()){
$host=$result['host'];?//門店
$mobile=$result['mobile'];?//手機號碼
?
td??php?echo?$i;?/td
td??php?echo?$host;?/td
td??php?echo?$mobile;?/td
/tr
?php?
$i--;
}?
?
/tbody
/table
數(shù)據(jù)上傳到php空間 。。數(shù)據(jù)代碼填對應的數(shù)據(jù)內容就可以了。。比如images=“xxxx.jif”把文件gif上傳到空間就好了。。路勁要指示真確。。。
?php
$Con?=?mysql_connect(.....);
//數(shù)據(jù)庫庫連接你自己寫
echo?'tabletr';
$i?=?0;
$Sql?=?mysql_query('select?字段名稱?from?表名稱');
while(?$Rs?=?mysql_fetch_attay(?$Sql?)?)?{
$i++;
echo?'td'?.?$Rs['字段名稱'].?'/td';
if?(?$i?%?3?==?0?)?{
echo?'/trtr';
}
}
echo?'/tr/table';
動態(tài)生成html代碼,然后打印出來就可以了呀。例如
//數(shù)據(jù)庫查詢代碼省略
$table?=?'table';
while($row?=?mysql_fetch_array($result)){
$table?.=?'trtd'.$row["xx"].'/tdtd'.$row["yy"].'/tdtr';
}
$table?.=?'/table';
echo($table);