Advertisement
Guest User

emonbabu

a guest
Mar 5th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2. include 'condb.php';
  3. $sql="CREATE TABLE students
  4. (
  5. id INT AUTO_INCREMENT PRIMARY KEY,
  6. student_name VARCHAR(100) NOT NULL,
  7. student_class INT(10) NOT NULL,
  8. student_roll INT(10) NOT NULL,
  9. student_section INT(15) NOT NULL
  10. )";
  11. $sql1="CREATE TABLE class(
  12. id INT AUTO_INCREMENT PRIMARY KEY,
  13. class_name VARCHAR(100) NOT NULL,
  14. class_numeric_value int(10) NOT NULL
  15. )";
  16. $sql2="CREATE TABLE section(
  17. id INT AUTO_INCREMENT PRIMARY KEY,
  18. class_id INT(10) NOT NULL,
  19. section_name VARCHAR(100) NOT NULL
  20. )";
  21. $sql3="CREATE TABLE parents(
  22. id INT AUTO_INCREMENT PRIMARY KEY,
  23. student_id INT(10) NOT NULL,
  24. parent_name VARCHAR(100) NOT NULL,
  25. parent_phone_number INT(10) NOT NULL
  26. )";
  27.  
  28. $conn->query($sql);
  29. $conn->query($sql1);
  30. $conn->query($sql2);
  31. $conn->query($sql3);
  32. ?>
  33.  
  34.  
  35. database cannect:
  36. <?php
  37.  
  38. $host="localhost";
  39. $user="root";
  40. $pass="";
  41. $db="school";
  42.  
  43. $conn=new mysqli($host,$user,$pass,$db);
  44.  
  45. if($conn->connect_error)
  46. {
  47. die("Error : ".$conn->connect_error);
  48. }
  49.  
  50.  
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement