Answers for "how to connect mysql to php"

PHP
18

mysql db connection in php

<?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.";
?>
Posted by: Guest on May-11-2020
1

database connectivity in php

<?php
///////////neha jaiswal/////
/////set variable/////////
$serve="localhost";
$user="root";
$password="";
$db="cart_system";///database name
///create connection with db////
$conn=mysqli_connect($serve,$user,$password,$db);
////check condition for connection fail or not
 if ($conn) {
 echo "connection success"; 
 }else
{echo "connection unsuccess"; 
 }
  ?>
Posted by: Guest on January-16-2021
0

how to connect to a mysql database using php

<?php
  $serverName = "localhost";
  $dBUsername = "root";
  $dBPassword = "";
  $dBName = "users";

  $conn = mysqli_connect($serverName, $dBUsername, $dBPassword, $dBName);

  if (!$conn) {
    die("Connection failed: " . mysqli_connection_error());
  }
Posted by: Guest on September-30-2021
0

connect database using php

php db connect
Posted by: Guest on October-17-2021

Browse Popular Code Answers by Language