Facebook
From Beige Leech, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 157
  1. <?php
  2. $regno=$_POST['r1'];
  3. $name=$_POST['n1'];
  4. $conn=mysqli_connect("localhost","root","");
  5. if(!$conn)
  6. echo "PhpMyAdmin not detected";
  7. if(!mysqli_select_db($conn,"first"))
  8. echo "Database is not connected";
  9. $sql="INSERT INTO reg(regno,name) VALUES('$regno','$name')";
  10. if(!mysqli_query($conn,$sql))
  11. echo "Values not inserted";
  12. $sql1="SELECT * FROM reg";
  13. $result=mysqli_query($conn,$sql1);
  14. while($res=mysqli_fetch_assoc($result))
  15. {
  16. echo $res['regno'];
  17. echo $res['name'];
  18.  
  19.  
  20. }
  21. ?>