免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
myssqli和mysql的函數(shù)
myssqli和mysql的函數(shù)是差不多的, 只不過(guò), mysqi可以用對(duì)象方式
1
2
3
4
5
6
//過(guò)程方式:
$Con = mysqli_connect('數(shù)據(jù)庫(kù)服務(wù)器地址', '數(shù)據(jù)庫(kù)登陸用戶(hù)', '數(shù)據(jù)庫(kù)密碼');
mysqli_select_db( $Con, '數(shù)據(jù)庫(kù)名稱(chēng)');
//對(duì)象方式
$Con = new mysqli('數(shù)據(jù)庫(kù)服務(wù)器地址', '數(shù)據(jù)庫(kù)登陸用戶(hù)', '數(shù)據(jù)庫(kù)密碼', '數(shù)據(jù)庫(kù)名稱(chēng)');
同樣是過(guò)程方式,mysqli有一點(diǎn)和mysql的用法不同的是,:
mysql函數(shù),很多函數(shù)都有2個(gè)參數(shù),一個(gè)是sql語(yǔ)句等, 一個(gè)是mysql連接標(biāo)識(shí), 而這個(gè)mysql連接標(biāo)識(shí)參數(shù)是可以省略的!
但是mysqli兩個(gè)參數(shù)必須, 而且順序相反, 比如:
1
2
3
4
5
mysql_query('show tables', $Con );
//也可以省略第二個(gè)參數(shù),寫(xiě)成:
mysql_query('show tables');
//但是mysqli不行
mysqli_query( $Con,  'show tables');
其他回答
下個(gè)php手冊(cè),里面有示例代碼
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db');
/*
* This is the "official" OO way to do it,
* BUT $connect_error was broken until PHP 5.2.9 and 5.3.0.
*/
if ($mysqli->connect_error) {
die('Connect Error (' . $mysqli->connect_errno . ') '
. $mysqli->connect_error);
}
/*
* Use this instead of $connect_error if you need to ensure
* compatibility with PHP versions prior to 5.2.9 and 5.3.0.
*/
if (mysqli_connect_error()) {
die('Connect Error (' . mysqli_connect_errno() . ') '
. mysqli_connect_error());
}
echo 'Success... ' . $mysqli->host_info . "\n";
$mysqli->close();
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶(hù)發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
MySQL 連接 | 菜鳥(niǎo)教程
PHP mysql_error() 函數(shù):返回上一個(gè)MySQL文本錯(cuò)誤信息
Fatal error: Uncaught Error: Call to undefined function mysql
解決Deprecated: mysql
連接mysql用mysql_connect不能連接
MySQL丨通過(guò) PHP 執(zhí)行 SQL 語(yǔ)句
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服