Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "bit2018";
- //create connection
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- //check connection
- if(!$conn)
- {
- die("connection failed: " . mysqli_connect_error());
- }
- //sql to create table
- $sql = "CREATE TABLE student_3rd(
- std_id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
- std_fname VARCHAR(255) NOT NULL,
- std_lname VARCHAR(255) NOT NULL,
- std_roll VARCHAR(255),
- std_contact VARCHAR(255),
- std_address VARCHAR(255)
- )";
- if (mysqli_query($conn, $sql))
- {
- echo "Table successfully created ";
- }
- else
- {
- echo"Error craeting table: " . mysqli_error($conn);
- }
- mysqli_close($conn);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement