Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. <body>
  2. <html>
  3. <?php
  4. $con=mysqli_connect("localhost","root","","dedatabase");
  5.  
  6. if (mysqli_connect_errno())
  7. {
  8. echo "Failed to connect to MySQL: " . mysqli_connect_error();
  9. }
  10. $pi = $_POST['proid'];
  11. $pn = $_POST['pname'];
  12. $d = $_POST['desc'];
  13. $p = $_POST['price'];
  14. $s = $_POST['stock'];
  15.  
  16. $sql= "INSERT INTO product
  17. VALUES ('$pi','$pn','$d','$p','$s')";
  18.  
  19. if(mysqli_query($con, $sql)){
  20. echo "Records inserted successfully.";
  21. } else{
  22. echo "ERROR: Could not able to execute $sql. " . mysqli_error($con);
  23. }
  24. mysqli_close($con);
  25. ?>
  26. </body>
  27. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement