Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $conn = mysqli_connect("localhost","root","theaakash");
- mysqli_query($conn,"create database EmpDBTest");
- $conn = mysqli_connect("localhost","root","theaakash","EmpDBTest");
- mysqli_query($conn,"create table emptest(EmpId varchar(30), EmpName varchar(30))");
- echo "Done";
- if(isset($_POST['sub']))
- {
- $id = $_POST['eid'];
- $name = $_POST['ename'];
- $stmt = $conn -> prepare("INSERT INTO emptest (EmpId,EmpName) VALUES (?,?)");
- $stmt -> bind_param("ss",$id,$name);
- if($stmt->execute())
- {
- echo "Inserted Successfully !!";
- }
- else{
- echo "Failed To Connect". $conn ->error;
- }
- }
- ?>
- <form action="db.php" method="post">
- ENter Id :
- <input type="text" name="eid" id="">
- Enter Name :
- <input type="text" name="ename" id="">
- <input type="submit" name="sub" value="Insert">
- </form>
Advertisement
Add Comment
Please, Sign In to add comment