欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

php的數(shù)據(jù)庫連接信息 php 數(shù)據(jù)庫連接

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

________profile.php____________

創(chuàng)新互聯(lián)公司提供網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站設(shè)計(jì)、網(wǎng)頁設(shè)計(jì),成都品牌網(wǎng)站建設(shè)1元廣告等致力于企業(yè)網(wǎng)站建設(shè)與公司網(wǎng)站制作,10多年的網(wǎng)站開發(fā)和建站經(jīng)驗(yàn),助力企業(yè)信息化建設(shè),成功案例突破1000+,是您實(shí)現(xiàn)網(wǎng)站建設(shè)的好選擇.

?php

$dbhost = '';//數(shù)據(jù)庫主機(jī)名

$dbuser = '';//數(shù)據(jù)庫用戶名

$dbpassword = '';//數(shù)據(jù)庫密碼

$dbname = '';//數(shù)據(jù)庫名

$tbname = '';//數(shù)據(jù)表名

$uid = intval($_GET['id']);

mysql_connect($dbhost,$dbuser,$dbpassword);

mysql_select_db('$dbname');

$sql = "SELECT * FROM `" . $tbname . "` WHERE `uid`='" . $uid. "'";

$result = mysql_query($sql);

$profile = mysql_fetch_array($result);

?

table

tr

th序號/th

td?php echo $profile['猜團(tuán)閉uid'];?穗裂/td

或笑/tr

tr

th性別/th

td?php echo $profile['sex'];?/td

/tr

tr

th郵箱/th

td?php echo $profile['email'];?/td

/tr

/table

__________end of profile.php________________

大概這樣,不懂請補(bǔ)充。

PHP7連接mysql數(shù)據(jù)庫方法

1、用 mysql_connect 的方法,PHP7會報致命錯誤

$conn= mysql_connect('localhost','xueyanxiang','xueyanxiang');

Fatal error : Uncaught Error: Call to undefined function mysql_connect() in /Users/xueyanxiang/work/test/xue.php:31 Stack trace: #0 /Users/xueyanxiang/work/test/xue.php(119): xue-run() #1 {main} thrown in? /Users/xueyanxiang/work/test/xue.php ?on line? 31

原因是:

PHP5中使用mysql_connect()函數(shù)塌信進(jìn)行連接,但團(tuán)蠢輪實(shí)際上,PHP5.5開始,MySQL就不推薦使用了,屬于廢棄函數(shù)

PHP7中貌似已經(jīng)徹底不支持了,根據(jù)官網(wǎng)說明,取而代之的是如下兩個:

本擴(kuò)展自 PHP 5.5.0 起已廢棄,并在將來會被移除。應(yīng)使用?MySQLi?或?PDO_MySQL?擴(kuò)展來替換之。參見?MySQL:選擇

API?指南以及相關(guān) FAQ?以獲取更多信息。用以替代本函數(shù)的有:

mysqli_connect()

PDO::__construct()

使用時,不要在使用mysql_connect了,可以換用mysqli_connect(),用法基本類似吧,據(jù)說是面向?qū)ο蟮膸臁?/p>

php.ini中,也只有extension=php_mysqli.dll,而不再有extension=php_mysql.dll這個拓展了。檔差

2、可以使用mysqli,對象化,方法名與被廢棄的類似

$conn= mysqli_connect('localhost','xueyanxiang','xueyanxiang');

3、PDO工具,推薦使用

$dbh= "mysql:host=localhost;dbname=test";

$db= new PDO($dbh,'xueyanxiang','xueyanxiang');

$objQuery= $db-query("select * from user;");

$res= $objQuery-fetchAll(PDO::FETCH_ASSOC);

不填寫參數(shù)的話,默認(rèn)是關(guān)聯(lián)和索引都有,如下圖

本文名稱:php的數(shù)據(jù)庫連接信息 php 數(shù)據(jù)庫連接
本文路徑:http://chinadenli.net/article29/dsppdch.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站排名定制開發(fā)全網(wǎng)營銷推廣外貿(mào)建站標(biāo)簽優(yōu)化ChatGPT

廣告

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

手機(jī)網(wǎng)站建設(shè)