Advertisement
AMERISA123

Untitled

May 27th, 2022
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. <?php
  2. include_once 'conexion.php';
  3. if($_POST){
  4. $ordendecompra = $_POST['n_orden'];
  5. $nombre = $_POST['nombre'];
  6. $correo = $_POST['email'];
  7. $direccion = $_POST['direccion'];
  8. $telefono = $_POST['telefono'];
  9. $codigo= $_POST['codigo'];
  10.  
  11. $descripcion= $_POST['descripcion'];
  12. $existencia= $_POST['existencia'];
  13. $precioventa= $_POST['precioventa'];
  14. $cantidad= $_POST['cantidad'];
  15. $subtotal= $_POST['subtotal'];
  16.  
  17.  
  18. $sql_actualizarventas= "INSERT INTO productos_vendidos(codigo,descripcion,existencia,precioventa,cantidad,subtotal,n_orden)VALUES('$codigo', '$descripcion', '$existencia',' $precioventa', '$cantidad', '$subtotal', '$ordendecompra')";
  19. $sql_insertar = "INSERT INTO orden_de_compra(ordendecompra,nombre,correo,direccion,telefono)VALUES('$ordendecompra','$nombre','$correo','$direccion','$telefono')";
  20. $validando_orden = mysqli_query($conexion, "SELECT * FROM orden_de_compra WHERE ordendecompra= '$ordendecompra'");
  21. if(mysqli_num_rows ($validando_orden) >0){
  22. echo "<p>Ya está registrado este codigo.</p>";
  23. exit();
  24. }
  25. if (mysqli_query($conexion, $sql_insertar,)|| (mysqli_query($conexion, $sql_actualizarventas) )
  26. ){
  27. echo "<p>Registro agregado.</p>";
  28. } else {
  29. echo "<p>No se agregó...</p>";
  30. }
  31.  
  32. echo "Se ingresó correctamente el código $ordendecompra";
  33. header ("refresh:5; url=http://localhost:8080/JoStore/login.html ");
  34. }
  35.  
  36.  
  37. else {
  38. echo "<p>No se agregó...</p>";
  39. }
  40.  
  41.  
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement