Skip to content

Commit 2634241

Browse files
Update README.md
1 parent 9f698f9 commit 2634241

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

README.md

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
1-
<!-- conection for database using mysqli for local host -->
2-
3-
<?php
4-
5-
$con = mysqli_connect("localhost","root","password","database_name");
6-
7-
?>
8-
9-
<!-- connection by PDO -->
10-
11-
<?php
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-
1+
SQL Database Connectivity using Mysqli and PDO method in PHP
2+
3+
PDO method is more secure then mysqli

0 commit comments

Comments
 (0)