Advertisement
Guest User

prabesh

a guest
Feb 11th, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $dbname = "bit2018";
  6. //create connection
  7. $conn = mysqli_connect($servername, $username, $password, $dbname);
  8. //check connection
  9. if(!$conn)
  10. {
  11. die("connection failed: " . mysqli_connect_error());
  12. }
  13. //sql to create table
  14. $sql = "CREATE TABLE student_3rd(
  15. std_id INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  16. std_fname VARCHAR(255) NOT NULL,
  17. std_lname VARCHAR(255) NOT NULL,
  18. std_roll VARCHAR(255),
  19. std_contact VARCHAR(255),
  20. std_address VARCHAR(255)
  21. )";
  22. if (mysqli_query($conn, $sql))
  23. {
  24. echo "Table successfully created ";
  25. }
  26. else
  27. {
  28. echo"Error craeting table: " . mysqli_error($conn);
  29. }
  30. mysqli_close($conn);
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement