How to select a database in php?



How to select a database in php?..

Answer / Ritu Wala

In PHP, you can use the `mysqli_select_db()` function to select a database when working with MySQLi. First, establish a connection using `mysqli_connect()`, then call `mysqli_select_db($connection, $databaseName)`. For PDO: `$pdo->exec('USE ' . $databaseName);`

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

How can we extract string 'abc.com' from a string "http://info@abc.com" using regular expression of PHP

6 Answers   Wipro,


How is it possible to propagate a session id?

1 Answers  


How does the identity operator ===compare two values in PHP?

1 Answers  


What is html used for?

1 Answers  


What is get and post method in php?

1 Answers  


Tell me is it possible to submit a form with a dedicated button?

1 Answers  


How do you sort an array in php?

1 Answers  


how to insert logout time when browser close

1 Answers   Global Softtech,


What is register_globals in php?

6 Answers   Castling IT, HCL, Intel Soft Solutions, Millennium,


How are Variables Defined in PHP?

6 Answers   T3 Softwares,


How can i send a HTML file to mail account.

2 Answers  


What is session management php?

1 Answers  


Categories