Search
 
SCRIPT & CODE EXAMPLE
 

PHP

PHP Create a MySQL Database

<?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);
}

// Create database
$sql = "CREATE DATABASE myDB";
if ($conn->query($sql) === TRUE) {
  echo "Database created successfully";
} else {
  echo "Error creating database: " . $conn->error;
}

$conn->close();
?>
Comment

create database in php

 /*MYSQL database can be created easily using this simple script.
The CREATE DATABASE statement creates the database.*/

<?php
   $con=mysqli_connect("example.com","username","password");
   $sql="CREATE DATABASE my_db";
   if (mysqli_query($con,$sql)) {
      echo "Database my_db created successfully";
   }
?>
Comment

php code to create database

<?php
session_start(); 
//error_reporting(0);
// if (isset($_GET['submit'])) {
// 	echo "button clicked";
// 	echo $_GET['name'];
// }
$servername = "localhost";
$username = "root";
$password = "";
$database = "epass";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $database);
// Check connection
if (!$conn) {
  die("Connection failed: " . mysqli_connect_error());
}
// echo "Connected successfully";
?>
Comment

PREVIOUS NEXT
Code Example
Php :: date formate in php 
Php :: routing code in drupal 8 
Php :: migration create symfony 
Php :: php string contains 
Php :: php replace blackslash 
Php :: php or 
Php :: parameterized function in php 
Php :: set timezone in php 
Php :: php check request method 
Php :: Flutter Error - Migrate to android studio - MAC OS 
Php :: PHP (WordPress) - Increase Maximum Upload File Size 
Php :: php uppercase with accent 
Php :: only display part of string php 
Php :: how to convert array to string in php 
Php :: date_sub laravel 7 
Php :: eloquent get only some columns 
Php :: php sort array by value length 
Php :: laravel try catch example 
Php :: first name of string php 
Php :: php fix array keys 
Php :: php get current dir mac 
Php :: how to define function in php 
Php :: php add array values with same keys 
Php :: how to get data from a table in laravel 
Php :: how to make-migrations in laravel 
Php :: how to send data from one website to another in php 
Php :: how see the list all artisan in laravel 
Php :: check if object has method php 
Php :: Fatal error: Allowed memory size of 1610612736 bytes exhausted but already allocated 1.75G 
Php :: laravel get single column value 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =