0

How can you use php to open the database (sql)?

9th Sep 2016, 4:09 PM
Dustin Garcia
Dustin Garcia - avatar
3 Answers
+ 1
mysqli_connect($_host,$_username,$_password.$_dbName)
9th Sep 2016, 9:42 PM
Hemant singh patwal
Hemant singh patwal - avatar
0
Or PDO: <?php $user = ""; $pass = ""; $conn = new PDO('mysql:host=localhost;dbname=myDB', $user, $pass); ?>
9th Sep 2016, 6:35 PM
Nenad__
Nenad__ - avatar
- 2
Make your question specific. Do you want to connect to the Database or Do you want to retrieve Results of a Query from the Database. To connect to the Database use. $conn=mysqli_connect("localhost", "root", "password", "my-database") localhost= that is your server root= your database username password= your database password my-database= your selected database To retrieve result of a Query from the Database $sql="SELECT * FROM table"; $result=$conn->query($sql); * = this means select all columns table= this is your selected table name Hope you have understood
10th Sep 2016, 12:02 PM
seun sola
seun sola - avatar