php7顯示數(shù)據(jù)庫信息 php的數(shù)據(jù)庫配置在哪

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

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

中方網(wǎng)站制作公司哪家好,找成都創(chuàng)新互聯(lián)!從網(wǎng)頁設計、網(wǎng)站建設、微信開發(fā)、APP開發(fā)、成都響應式網(wǎng)站建設公司等網(wǎng)站項目制作,到程序開發(fā),運營維護。成都創(chuàng)新互聯(lián)2013年開創(chuàng)至今到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗和運維經(jīng)驗,來保證我們的工作的順利進行。專注于網(wǎng)站建設就選成都創(chuàng)新互聯(lián)。

?php

$server='localhost';

$user='root';

$pass='12345';

$dbname='ppq';

$conn=mysql_connect($server,$user,$pass);

if(!$conn)

die("數(shù)據(jù)庫系統(tǒng)連接失敗!");

$result=mysql_list_tables($dbname);

if(!$result)

die("數(shù)據(jù)庫連接失??!");

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ù)庫中的表

說明

resource

mysql_list_tables

(

string

database

[,

resource

link_identifier])

mysql_list_tables()

接受一個數(shù)據(jù)庫名并返回和

mysql_query()

函數(shù)很相似的一個結果指針。用

mysql_fetch_array()或者用mysql_fetch_row()來獲得一個數(shù)組,數(shù)組的第0列就是數(shù)組名,當獲取不到時

mysql_fetch_array()或者用mysql_fetch_row()返回

FALSE。

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

這個簡單?。?/p>

首頁做個前臺輸入姓名和會員卡信息的頁面,我做個簡單的頁面給你看

!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會員查詢系統(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

然后我給你一個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);

?

頁面美化自己去搞!只能幫你這么多了

PHP 怎么顯示數(shù)據(jù)庫中的數(shù)據(jù) 求源代碼

讀數(shù)據(jù)庫,以表格輸出的示例代碼:

?php

header('Content-type:text/html;charset=utf-8');

$db = new mysqli('localhost','root','root','books');

$rows = $db-query('SELECT * FROM customers');

echo 'table border="1"trtd姓名/tdtd年齡/td/tr';

while($row = $rows-fetch_assoc()){

echo 'trtd'.$row['name'].'/td';

echo 'td'.$row['address'].'/td/tr';

}

?

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

初學者寫的,你可以試試

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

table?border="1"

tr

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

div?align="center"請輸入用戶名稱

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(服務器,用戶名,密碼)

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

//?mysql_select_db(數(shù)據(jù)庫,$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;'對不起,您查找的用戶信息不存在!/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

當前標題:php7顯示數(shù)據(jù)庫信息 php的數(shù)據(jù)庫配置在哪
文章鏈接:http://muchs.cn/article48/dosjphp.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導航、網(wǎng)站營銷響應式網(wǎng)站、手機網(wǎng)站建設網(wǎng)站策劃、軟件開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設