Advertisement
Guest User

Untitled

a guest
Oct 10th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "xxxxx";
  4. $password = "xxxxx";
  5. $dbname = "xxxxx";
  6. $dateTimeVariable = date( "Y-m-d H:i:s" );
  7. $stock = -$_POST[ sto ];
  8. // Create connection
  9. $conn = new mysqli( $servername, $username, $password, $dbname );
  10. // Check connection
  11. if ( $conn->connect_error ) {
  12. die( "Connection failed: " . $conn->connect_error );
  13. }
  14. if ( !empty( $_POST[ 'vnos' ] ) ) {
  15. $sql = "INSERT INTO StockEntry (part_id, user_id, stockLevel, price, dateTime, correction, comment)
  16. VALUES ('$_POST[vnos]', '3', '$stock', '', '$dateTimeVariable', '0', 'test')";
  17.  
  18. if ( $conn->query( $sql ) === TRUE ) {
  19. echo "New record created successfully";
  20. } else {
  21. echo "Error: " . $sql . "<br>" . $conn->error;
  22. }
  23. }
  24. $conn->close();
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement