How can we connect to a mysql database from a php script?
Answer / Ankit Kumar Rathi
To connect to a MySQL database from a PHP script, you need to use the mysqli extension. Here's an example: <?php $conn = new mysqli("localhost", "username", "password", "database"); if ($conn->connect_error) {n die("Connection failed: " . $conn->connect_error);n}n ?>
| Is This Answer Correct ? | 0 Yes | 0 No |
What are the different filter functions used to filter a variable?
i'm b.com graduate and doing MCM- 1year(Master in Computer Management. i'm very interested in PHP? Please tell me some suggetion and the scope of PHP in the market. My E-mail pawan.register@gmail.com Thanks & Regards Pawan.
How many types of array supported in php?
How can I retrieve values from one database server and store them in other database server using PHP?
How to execute an sql query?
What is the difference between PHP,ASP and JSP?
What is the difference between ereg_replace() and eregi_replace()?
What is php mean?
What is difference between strstr() and stristr() in PHP?
How to turn on the session support?
Tell us what does $_cookie means?
What is the php function that removes the first element of the array and returns it?