adspace


How do you connect MySQL database with PHP?

Answer Posted / Jinkal Chaudhary

To connect a MySQL database with PHP, you can use functions like `mysql_connect()` or the more modern `PDO` (PHP Data Objects) and MySQLi (MySQL Improved Extension). With `mysql_connect()`, you provide the hostname, username, password, and database name as arguments. For PDO, you create a new instance of it and call `setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION)` to handle errors.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is current version of mysql?

1081


How to Change a users password from unix shell.

1221


Which statement is used in a select query for partial matching?

1247


What is the current mysql version?

1103