新聞中心
如何用php獲取數(shù)據(jù)庫(kù)信息并顯示
獲取ppq數(shù)據(jù)庫(kù)的所有表名的代碼:
10年積累的成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)經(jīng)驗(yàn),可以快速應(yīng)對(duì)客戶對(duì)網(wǎng)站的新想法和需求。提供各種問(wèn)題對(duì)應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識(shí)你,你也不認(rèn)識(shí)我。但先網(wǎng)站設(shè)計(jì)后付款的網(wǎng)站建設(shè)流程,更有臨潭免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
?php
$server='localhost';
$user='root';
$pass='12345';
$dbname='ppq';
$conn=mysql_connect($server,$user,$pass);
if(!$conn)
die("數(shù)據(jù)庫(kù)系統(tǒng)連接失敗!");
$result=mysql_list_tables($dbname);
if(!$result)
die("數(shù)據(jù)庫(kù)連接失敗!");
while($row=mysql_fetch_row($result))
{
echo
$row[0]."態(tài)蘆
";
}
mysql_free_result($result);
?
mysql_list_tables
(PHP
3,
PHP
4
,
PHP
5)
mysql_list_tables
--
列出
MySQL
數(shù)據(jù)庫(kù)中的表
說(shuō)明
resource
mysql_list_tables
(
string
database
[,
resource
link_identifier])
mysql_list_tables()
接受一個(gè)數(shù)據(jù)庫(kù)名并返回和
mysql_query()
函數(shù)很相似的一顫羨個(gè)茄閉拍結(jié)果指針。用
mysql_fetch_array()或者用mysql_fetch_row()來(lái)獲得一個(gè)數(shù)組,數(shù)組的第0列就是數(shù)組名,當(dāng)獲取不到時(shí)
mysql_fetch_array()或者用mysql_fetch_row()返回
FALSE。
thinkphp數(shù)據(jù)庫(kù)數(shù)據(jù)在view顯示出來(lái)
thinkphp數(shù)肢巧啟據(jù)庫(kù)數(shù)據(jù)在寬敗view顯示出來(lái)的方法如下:
1、在數(shù)據(jù)庫(kù)新建一個(gè)數(shù)據(jù)表thinkphp,在表內(nèi)插入幾條記錄。
2、或在配置好的Thinkphp環(huán)境中,新建一歷如個(gè)控制器。
php如何查詢數(shù)據(jù)庫(kù)表中的數(shù)據(jù)并顯示
這個(gè)簡(jiǎn)單啊!
首頁(yè)做個(gè)前臺(tái)輸入姓名和會(huì)員卡信息的頁(yè)面,我做個(gè)簡(jiǎn)單的頁(yè)面給你看
!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ù)庫(kù)用戶名","數(shù)據(jù)庫(kù)密碼");
if?(!$con)
{
die('Could?攔仔not?connect:?'?.?mysql_error());
}
$a????=????mysql_select_db("數(shù)據(jù)庫(kù)名字",?$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);
?
頁(yè)面美化自己去搞!只能幫你這么多了
當(dāng)前題目:php顯示數(shù)據(jù)庫(kù)中數(shù)據(jù) php顯示數(shù)據(jù)庫(kù)中數(shù)據(jù)不存在
鏈接URL:http://ef60e0e.cn/article/ddpscod.html