We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ca3078a commit 9f698f9Copy full SHA for 9f698f9
README.md
@@ -1,2 +1,22 @@
1
-# connection-of-SQL-database-using-PHP
2
-Database Connectivity using Mysqli and PDO method in PHP
+<!-- conection for database using mysqli for local host -->
+
3
+<?php
4
5
+$con = mysqli_connect("localhost","root","password","database_name");
6
7
+?>
8
9
+<!-- connection by PDO -->
10
11
12
+ $user='root';
13
+ $pass='';
14
+ $dbname='database_name';
15
16
+ $conn = new PDO('mysql:host=localhost;dbname= database_name', $user, $pass);
17
+ if (!$conn) {
18
+ die("Connection failed: " . $conn->connect_error);
19
+ }
20
+ $conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
21
22
0 commit comments