Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php sql connection string

$servername = "localhost";
$username = "username";
$password = "password";

try {
  $conn = new PDO("mysql:host=$servername;dbname=myDB", $username, $password);
  // set the PDO error mode to exception
  $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  echo "Connected successfully";
} catch(PDOException $e) {
  echo "Connection failed: " . $e->getMessage();
}
Comment

PREVIOUS NEXT
Code Example
Php :: yii2 where in 
Php :: run laravel localhost network 
Php :: how to start a session 
Php :: PHP wordwrap() Function 
Php :: laravel number add 0 before 
Php :: usleep php 
Php :: get taxonomy term id from slug - WordPress 
Php :: wp show logo 
Php :: get request uri from request laravel 7 
Php :: Wordpress hook for newly published post 
Php :: send variable to get_template_part 
Php :: php remove all but numbers 
Php :: unique value when two columns laravel migration 
Php :: make a seeding file in laravel 
Php :: laravel auth register false 
Php :: how to add properties to the request object in laravel 
Php :: remove gutenberg styles 
Php :: switch in laravel 
Php :: php 7 to php 8 in ubuntu 20.04 
Php :: php array_sum 
Php :: the token has been blacklisted laravel jwt 
Php :: wherebetween in laravel 
Php :: laravel get host with http 
Php :: get host from url php 
Php :: laravel Post model for flat file CMS 
Php :: joomla redirect 
Php :: age php datetime 
Php :: php number format 2 decimal no comma 
Php :: phpspreadsheet password protected 
Php :: laravel migrate only one table 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =