Advertisement
shohan11421

2no

Apr 12th, 2021
808
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1.  <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "root";
  5. $dbname = "sectionN";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn->connect_error) {
  11.   die("Connection failed: " . $conn->connect_error);
  12. }
  13.  
  14. // sql to create table
  15. $sql = "CREATE TABLE zobayer (
  16. id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  17. firstname VARCHAR(30) NOT NULL,
  18. lastname VARCHAR(30) NOT NULL,
  19. email VARCHAR(50),
  20. address VARCHAR(50),
  21. cgpa VARCHAR(50),
  22. )";
  23.  
  24. if ($conn->query($sql) === TRUE) {
  25.   echo "Table MyGuests created successfully";
  26. } else {
  27.   echo "Error creating table: " . $conn->error;
  28. }
  29.  
  30. $conn->close();
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement