php顯示數(shù)據(jù)庫(kù)部分?jǐn)?shù)據(jù),php查詢(xún)sql數(shù)據(jù)并顯示

php如何查詢(xún)數(shù)據(jù)庫(kù)表中的數(shù)據(jù)并顯示

這個(gè)簡(jiǎn)單啊!

成都創(chuàng)新互聯(lián)于2013年創(chuàng)立,是專(zhuān)業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站制作網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元惠濟(jì)做網(wǎng)站,已為上家服務(wù),為惠濟(jì)各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:18980820575

首頁(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ì)員查詢(xún)系統(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="查詢(xún)"?/

/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è)面美化自己去搞!只能幫你這么多了

怎樣用php查詢(xún)數(shù)據(jù)庫(kù)里的一個(gè)數(shù)據(jù)并顯示

面向過(guò)程:

$sql = "select t_bumen from t_xinxi where id=111"; //Sql語(yǔ)句

$result = mysql_fetch_assoc(mysql_query($sql)); //執(zhí)行sql語(yǔ)句并以關(guān)聯(lián)數(shù)組保存

print_r($result); //輸出數(shù)組

PHP文件在網(wǎng)頁(yè)里顯示部分php代碼(想顯示數(shù)據(jù)庫(kù)表里面的數(shù)據(jù))

因?yàn)槟闵賹?xiě)了一個(gè)大括號(hào)的結(jié)尾。

修改后:

table?id="DataList1"?cellspacing="0"?border="0"?width="100%"

?php

$db?=?mysqli_connect('localhost',?'root','root');//連接MySQL服務(wù)器

mysqli_select_db($db,'ticket');//選擇數(shù)據(jù)庫(kù)文件

if(mysqli_connect_errno()){

echo?"Error:Could?not?connect?to?mysql?ticket"; exit;

}

$q="select?*?from?news";//設(shè)置查詢(xún)指令

$result=mysql_query($db,$q);//執(zhí)行查詢(xún)

while($row=mysql_fetch_assoc($result))?//將result結(jié)果集中查詢(xún)結(jié)果取出一條

{

echo"trtd".$row["news"]."/tdtd".$row["date"]."/td/tr";?exit;

}

}?//?就是這樣?

?

/table

謝謝謝謝謝謝碼密。的入輸要需所面。界理管臺(tái)后器。由路陸登是。碼密理管。廖仲庭。器由。路。

如何用php獲取數(shù)據(jù)庫(kù)信息并顯示

獲取ppq數(shù)據(jù)庫(kù)的所有表名的代碼:

?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]."

";

}

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。

當(dāng)前名稱(chēng):php顯示數(shù)據(jù)庫(kù)部分?jǐn)?shù)據(jù),php查詢(xún)sql數(shù)據(jù)并顯示
分享網(wǎng)址:http://muchs.cn/article26/pheccg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)、外貿(mào)建站、用戶體驗(yàn)、品牌網(wǎng)站制作、網(wǎng)站維護(hù)、網(wǎng)頁(yè)設(shè)計(jì)公司

廣告

聲明:本網(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è)