Hướng dẫn mysql_connect error
Home » Database Lỗi “Uncaught error: call to undefined function mysql_connect()” xảy ra vì các hàm mysql_ * bị loại bỏ hoàn toàn khỏi PHP 7, trước đây nó không được chấp nhận trong PHP 5.5, nhưng
bây giờ nó đã bị loại bỏ hoàn toàn. Cách 1: Sử dụng MySQLI (PHP 4, PHP 5) mysql_connect — Open a connection to a MySQL Server Descriptionmysql_connect( Parametersserver The MySQL server. It can also include a port number. e.g. "hostname:port" or a path to a local socket e.g. ":/path/to/socket" for the localhost. If the PHP directive mysql.default_host is undefined (default), then the default value is 'localhost:3306'. In SQL safe mode, this parameter is ignored and value 'localhost:3306' is always used. username The username. Default value is defined by mysql.default_user. In SQL safe mode, this parameter is ignored and the name of the user that owns the server process is used. password The password. Default value is defined by mysql.default_password. In SQL safe mode, this parameter is ignored and empty password is used. new_link If a second call is made to mysql_connect() with the same arguments, no
new link will be established, but instead, the link identifier of the already opened link will be returned. The client_flags
The Return Values Returns a MySQL link identifier on success or ExamplesExample #1 mysql_connect() example
Example #2
mysql_connect() example using
Example #3 mysql_connect() example using ":/path/to/socket" syntax
$link = mysql_connect(':/tmp/mysql', 'mysql_user', 'mysql_password'); Notes
See Also
nicodenboer at yahoo dot com ¶ 10 years ago
Steve ¶ 14 years ago
VTool ¶ 5 years ago
sky dot sama dot remove dot dots at Gmail dot com ¶ 15 years ago
pepik at gmail dot cz ¶ 9 years ago
Peter Robinett ¶ 14 years ago
cory dot mawhorter gmail.com ¶ 13 years ago
jslakva at gmail dot com ¶ 15 years ago
martin ¶ 15 years ago
Ignacio Casinelli Esviza ¶ 14 years ago
= @mysql_connect($server,$user,$pass); amn -at- frognet.net ¶ 19 years ago
avinc@live,hk ¶ 11 years ago
tpl99 at yandex dot ru ¶ 12 years ago
Harouk ¶ 11 years ago
martinnitram at excite dot com ¶ 18 years ago
Graham_Rule at ed dot ac dot uk ¶ 15 years ago
Graham_Rule at ed dot ac dot uk ¶ 19 years ago
aeolianmeson at blitzeclipse dot com ¶ 14 years ago
abelcheung at gmail dot com ¶ 12 years ago
angelo [at] mandato 15 years ago
GetMyConnection() arithmetric at gmail dot com ¶ 14 years ago
bimal at sanjaal dot com ¶ 11 years ago
brinca at substancia dot com ¶ 15 years ago
trev at dedicate dot co dot uk ¶ 10 years ago
chaoscontrol_hq at yahoo dot com ¶ 18 years ago
rui dot batista at netcabo dot pt ¶ 16 years ago
yangqingrong at wudimei dot com ¶ 9 years ago
pascalxusNOSPAM at yahoo dot com ¶ 14 years ago
Anonymous ¶ 17 years ago
Contact at LinuxIntro dot com ¶ 13 years ago
sholland at napervillegi dot com ¶ 12 years ago
david dot schueler at wapkamera dot de ¶ 13 years ago
dan at novapulsar dot com ¶ 14 years ago
?>
php at lanar dot com dot au ¶ 10 years ago
bmagilavy at avalon-internet dot com ¶ 14 years ago
|