Mysql_select_db - Manual - PHP
Có thể bạn quan tâm
- Downloads
- Documentation
- Get Involved
- Help
-
- PHP Manual
- Function Reference
- Database Extensions
- Vendor Specific Database Extensions
- MySQL
- MySQL (Original)
- MySQL Functions
(PHP 4, PHP 5)
mysql_select_db — Select a MySQL database
WarningThis extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide. Alternatives to this function include:
- mysqli_select_db()
- PDO::__construct() (part of dsn)
Description
mysql_select_db(string $database_name, resource $link_identifier = NULL): boolSets the current active database on the server that's associated with the specified link identifier. Every subsequent call to mysql_query() will be made on the active database.
Parameters
database_name
The name of the database that is to be selected.
link_identifierThe MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() had been called with no arguments. If no connection is found or established, an E_WARNING level error is generated.
Return Values
Returns true on success or false on failure.
Examples
Example #1 mysql_select_db() example
<?php$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');if (!$link) { die('Not connected : ' . mysql_error());}// make foo the current db$db_selected = mysql_select_db('foo', $link);if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error());}?>Notes
Note:
For backward compatibility, the following deprecated alias may be used: mysql_selectdb()
See Also
- mysql_connect() - Open a connection to a MySQL Server
- mysql_pconnect() - Open a persistent connection to a MySQL server
- mysql_query() - Send a MySQL query
Found A Problem?
Learn How To Improve This Page • Submit a Pull Request • Report a Bug +add a noteUser Contributed Notes
There are no user contributed notes for this page.Từ khóa » Db Php
-
PHP MySQL Connect To Database - W3Schools
-
PHP MySQL Create Database - W3Schools
-
PHP에서 MySQL로 DB 관련 함수 - 리뷰 퍼주는 남자 - 리퍼남
-
Package Information: DB - PHP Pear
-
Database: Getting Started - The PHP Framework For Web Artisans
-
PHP MySQL 서버에 연결 / Database 와 Table 생성
-
How To Connect MySQL Database With PHP Website - Cloudways
-
Làm Thế Nào để Kết Nối PHP Với MySQL Database - Hostinger
-
[PHP] PHP DB관련 코드 정리 - 막내의 막무가내 프로그래밍 & 일상
-
Create MySQL Database Using PHP - Tutorialspoint
-
GitHub - Tschoffelen/p
-
[MariaDB] 마리아DB PHP - PHP와 MariaDB 연계 (MySQL)
-
How To Connect HTML To Database With MySQL Using PHP? An ...
-
ADOdb - Database Abstraction Layer For PHP [ADOdb]
-
How To Insert Form Data Into Database Using PHP ? - GeeksforGeeks
-
Adminer - Database Management In A Single PHP File
-
Unknown Database Error When Connecting Sql Database To Server ...