Search
 
SCRIPT & CODE EXAMPLE
 

PHP

PHP MySQL Create Table

<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "myDB";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}

// sql to create table
$sql = "CREATE TABLE MyGuests (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
email VARCHAR(50),
reg_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
)";

if ($conn->query($sql) === TRUE) {
  echo "Table MyGuests created successfully";
} else {
  echo "Error creating table: " . $conn->error;
}

$conn->close();
?>
Comment

create Tables database in php

<?php
   $con=mysqli_connect("example.com","username","password","my_db");
   $sql="CREATE TABLE table1(Username CHAR(30),Password CHAR(30),Role CHAR(30))";
   if (mysqli_query($con,$sql)) {
      echo "Table have been created successfully";
   }
?>
Comment

PREVIOUS NEXT
Code Example
Php :: define home url wordpress config.php 
Php :: woocommerce change place order button text 
Php :: how to connect to a database in php 
Php :: upload file in wp from url 
Php :: How to Disable the WordPress JSON REST API Without Plugin 
Php :: phpMyAdmin is not able to cache templates 
Php :: composer memory limit 
Php :: laravel carbon count days between dates 
Php :: how to create controller in specific folder laravel 
Php :: wordpress get post time 
Php :: default sort yii2 
Php :: cut string in php 
Php :: php laravel xml to json 
Php :: only alphabets and space is allowed validation laravel 
Php :: how to split url in php 
Php :: laravel database connection check 
Php :: increment single column laravel 
Php :: check if array has value php 
Php :: laravel eloquent merge request 
Php :: remove register route in laravel 
Php :: sort array by key value in php 
Php :: laravel log permission denied mac 
Php :: array to object php 
Php :: php array_sum 
Php :: current date in carbon 
Php :: php debug telegram bot 
Php :: how to do laravel in sidebar active menu dynamic blade 
Php :: install phpunit on ubuntu 18.04 
Php :: if online php 
Php :: get logged user id laravel 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =