Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. $sql = "INSERT INTO orders (orderID) VALUES ('.$rnd_id.'); ";
  2. $sql.= "INSERT INTO order_details (
  3. orderID,
  4. orderType,
  5. orderDate,
  6. orderTime,
  7. quantity,
  8. orderPrice,
  9. discount,
  10. discountPrice,
  11. employeeID
  12. )
  13. SELECT
  14. '.$rnd_id.' ,
  15. '.$type.' ,
  16. '.$date.' ,
  17. '.$time.' ,
  18. '.$quantity.' ,
  19. (unitPrice * '.$quantity.'),
  20. '.$dis.' ,
  21. (unitPrice * '.$quantity.') - ((unitPrice * '.$quantity.') * '.$dis.') ,
  22. '.$eid.'
  23. FROM product WHERE productID = '.$pid.'
  24. ; ";
  25.  
  26. if (!$link->multi_query($sql)) {
  27. echo "Multi query failed: (" . $link->errno . ") " . $link->error;
  28. }
  29.  
  30. do {
  31. if ($res = $link->store_result()) {
  32. var_dump($res->fetch_all(MYSQLI_ASSOC));
  33. $res->free();
  34. }
  35. } while ($link->more_results() && $link->next_result());
  36.  
  37. product
  38.  
  39. productID
  40. productName
  41. categoryID
  42. unitPrice
  43. unitsInStock
  44. discontinued
  45.  
  46. order_details
  47.  
  48. orderID
  49. orderType
  50. orderDate
  51. orderTime
  52. productID
  53. quantity
  54. orderPrice
  55. discount
  56. discountPrice
  57. employeeID
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement