PHP WITH MYSQL DATABASE CONNECTION - PHP LESSON 18 STUDENTSBLOG100 - Anna University Multiple Choice Questions

PHP WITH MYSQL DATABASE CONNECTION - PHP LESSON 18 STUDENTSBLOG100

To establish the connection to MySql server, the command used is,
  • mysqli_connect( );
To terminate the connection, the command used is,
  • mysqli_close( );
Establish Connection:
Four arguments should be passed in mysqli_connect( ) to start connection, they are
  • HostName : Name of your server or IP ( For local servers, 'localhost' is the host name.
  • UserName : MySql user name.... Default name is 'root'
  • Password : Leave blank if you didn't give password for MySql server
  • DataBase Name : Database to be used.... It is optional argument.
Syntax:
mysqli_connect(hostname, username, password, db_name);

Example:

Connectivity Check:

Output:
Connected successfully

Lesson 17 Previous | Main Page | Next Lesson 19

No comments:

Post a Comment