Sql conn

This article is tagged with: Sql conn and mysql

php sql connection

<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";
// Create connection
$conn= mysqli_connect($servername,$username,$password,$dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected Successfully.";
?>

sql conn

Always use Prepared Statements
Watch out for SQL injections!!!

sql conn

Always use Prepared Statements
Watch out for SQL injections!!!

how to connect to a database in php

<?php
$servername = "localhost";
$username = "username";
$password = "password";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>

This article is tagged with: Sql conn and mysql