Site icon DataFlair

How to Create Alter Drop Table in PHP MySQL

Program 1

<html>
<body>
    <center>
<pre>

<?php
             $servername="localhost";
             $username="root";
             $password="";
             $dbname="Library";
             $mycon=mysqli_connect($servername,$username,$password,$dbname) or die("Connection failed....");
             echo "Connection success......";
             // create table 
             $sql="create table student(sid int(5) Primary key ,sname varchar(30),course varchar(30))";
              //$sql="alter table student add email varchar(30)";
             // $sql="drop table student";
               $mycon->query($sql);
              echo "Table created ..........";
             //echo "Table upated ..........";
              //  echo "Table droped ..........";
               $mycon->close();
               echo "Connection closed..........";              


?>
</pre>
</center>
</body>
</html>

 

Exit mobile version