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 :: laravel using username instead of email 
Php :: symfony messenger routing 
Php :: connect rabbitMQ 
Php :: how to make a child theme in wordpress 
Php :: export mysql data to word in php 
Php :: start php cli 
Php :: php foreach loop 
Php :: php functions parameters 
Php :: wordpress enable post thumbnail 
Php :: get users other than specific role laravel role spatie 
Php :: how to get client ip address in php 
Php :: php url variables 
Php :: laravel post request page csrf disable 
Php :: how to send data from html to php 
Php :: transaction laravel 
Php :: phpmyadmin drop database 
Php :: Getting the closest string match using php 
Php :: dd php 
Php :: sort an array in php manually 
Php :: get data from csv file in php and print in table 
Php :: extract text before last space php 
Php :: wocommerce product image 
Php :: return json in php 
Php :: laravel uuid not showing in query 
Php :: wordpress query get results 
Php :: sort by number of views descending laravel 
Php :: laravel check if collection has value 
Php :: firstOrFail() 
Php :: carbon this month first day 
Php :: sum two numbers in php 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =