php讀取數(shù)據(jù)庫計(jì)算 php讀取sql數(shù)據(jù)

PHP 讀取多條數(shù)據(jù)庫中數(shù)據(jù)

拿下面這段單獨(dú)建個(gè)頁面,改一下你的數(shù)據(jù)庫名,表等信息試試。

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

table width="50%" border="0"

tr

tdID/td

tdID2/td

tdorder1/td

tdorder2/td

tdorder3/td

/tr

?php

//連接數(shù)據(jù)庫

$conn=@ mysql_connect("服務(wù)器地址","用戶名","密碼") or die("連接數(shù)據(jù)庫失敗!");

mysql_select_db("數(shù)據(jù)庫名",$conn) or die("連接數(shù)據(jù)庫失敗!");

mysql_query("set names 'GBK'");

//連接結(jié)束

//接收提交過來查詢的ID

$id=$_POST["id"];

//查詢數(shù)據(jù)庫相關(guān)數(shù)據(jù)

$sql="select * from 數(shù)據(jù)表名 where ID2='".$id."' order by id desc";

$query=mysql_query($sql);

//循環(huán)輸出

while($row=mysql_fetch_array($query)){

?

tr

td?php echo $row["ID"];?/td

td?php echo $row["ID2"];?/td

td?php echo $row["order1"];?/td

td?php echo $row["order2"];?/td

td?php echo $row["order3"];?/td

/tr

?php

}

?

/table

form name="form1" method="post" action=""

input type="text" name="id"

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

/form

php sql讀取數(shù)據(jù)庫

?php

$str=$_GET['b'];

$sql

=

"SELECT

*

FROM

`zz`

where

b=$str";

$results=mysql_query($sql);

while($row

=

mysql_fetch_array($results))

{

echo($row['a']."br");

}

?

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

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

?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()

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

mysql_query()

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

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

mysql_fetch_array()或者用mysql_fetch_row()返回

FALSE。

php怎么從數(shù)據(jù)庫取值

$urls = "192.168.0.128";//你的主機(jī)地址(一般是localhost)

$user = "root";//數(shù)據(jù)庫用戶名

$password = "111111";//數(shù)據(jù)庫密碼

$con = mysqli_connect($urls,$user,$password);//mysql數(shù)據(jù)庫連接

mysqli_select_db($con,"le_test");//第二個(gè)參數(shù)為數(shù)據(jù)庫名稱

mysqli_query($con,"select click_num from fstk_zhi_click where id0");//查詢所有click_num

mysqli_close($con);//關(guān)閉連接

php讀取數(shù)據(jù)庫問題

?

require_once "inc/conn.php";

$exec="select * from config";

$result=mysql_query($exec);

if ($rs=mysql_fetch_array($result))

{

$sitemane=$rs["sitemane"];

$siteurl=$rs["siteurl"];

$keyword=$rs["keyword"];

}

echo "!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"\"\r\nhtml xmlns=\"\"\r\nhead\r\nmeta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" /title";

echo "{$website}";

echo "/title";

echo "body";

echo "{$website}";

echo "$sitename";

echo "ddd";

echo "{$siteurl}";

echo "/body";

?

分享標(biāo)題:php讀取數(shù)據(jù)庫計(jì)算 php讀取sql數(shù)據(jù)
本文來源:http://muchs.cn/article12/hgiodc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗(yàn)、網(wǎng)站維護(hù)、靜態(tài)網(wǎng)站網(wǎng)站建設(shè)、網(wǎng)站制作、App開發(fā)

廣告

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

小程序開發(fā)