Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. error_reporting(E_ALL); ini_set('display_errors', 1); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $dbname = "ahmed";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn->connect_error) {
  11. die("Connection failed: " . $conn->connect_error);
  12. }
  13. $code=$_POST['code'];
  14. $type= $_POST['type'];
  15. $designation=$_POST['designation'];
  16. $qte_stock=$_POST['qte_stock'];
  17. $qte_depart=$_POST['qte_depart'];
  18. $famille=$_POST['famille'];
  19.  
  20. $sql = "INSERT INTO produits(code,type,designation,qte_stock,qte_depart,famille)
  21. VALUES ($code,$type,$designation,$qte_stock,$qte_depart,$famille)";
  22. if ($conn->query($sql) === TRUE) {
  23. echo "New record created successfully";
  24. } else {
  25. echo "Error: " . $sql . "<br>" . $conn->error;
  26. }
  27.  
  28. $conn->close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement