How do you connet mysql database with php?



How do you connet mysql database with php?..

Answer / Km. Parveen Khan

To connect to a MySQL database in PHP, you can 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

Post New Answer

More PHP Interview Questions

What is "print" in php?

1 Answers  


What is the difference between array_map () and array_shift ()?

1 Answers  


What is the mysql injection?

1 Answers  


Explain me what are the main error types in php and how do they differ?

1 Answers  


What is the difference between InnoDb tables and MyIsam Tables in php

1 Answers  


how to send mail in php but mail should be send in inbox not in spam.....:(

2 Answers   ATS,


how to register website in internet

2 Answers  


What is c++ polymorphism?

1 Answers  


What are the different types of php variables?

1 Answers  


What is get method in java?

1 Answers  


display selected value in dropdown list through javascript without page refresh

5 Answers   ASD Lab,


is that "enumerated array" equal to "numeric array"?

1 Answers   Maxil Technologies,


Categories