Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $server = 'localhost';
- $user = 'root';
- $pass = '';
- $conn = mysqli_connect($server, $user, $pass);
- if (!$conn){
- echo "Failed to connect to Server";
- }else{
- echo "Connected";
- }
- $sql = 'CREATE DATABASE college';
- $table = 'CREATE TABLE students(
- student_id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
- student_name VARCHAR(255) NOT NULL,
- student_email VARCHAR(255) NOT NULL,
- student_city VARCHAR(255) NOT NULL,
- )';
- if(mysqli_query($conn,$sql)){
- echo"Database created";
- }else{
- echo 'Failed to create Database';
- };
- if(mysqli_query($conn,$table)){
- echo "Table Created";
- }else{
- echo "Failed to create Table";
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement