fork download
  1. <?php
  2.  
  3.  
  4. require_once "../database/dbconn.php";
  5.  
  6.  
  7. $session_id = session_id();
  8.  
  9. $cust_id = $_SESSION['custid'];
  10.  
  11. require_once "../database/dbconn.php";
  12.  
  13. $conn = connect ();
  14.  
  15. $action = $_GET['action'];
  16.  
  17. switch ($action)
  18. {
  19. case 'update':
  20. {
  21. $session_id = $_POST['sid'];
  22. $customer_id = $_POST['cid'];
  23. $product_id = $_POST['pid'];
  24. $quantity = $_POST['quantity'];
  25.  
  26. $query = "UPDATE cart set quantity = '$quantity' where session_id = '$session_id' and customer_id = '$cust_id' and product_id = '$product_id'";
  27.  
  28. $result = mysqli_query($conn, $query);
  29. $row = mysqli_affected_rows($conn);
  30.  
  31. if ($row > 0)
  32. {
  33. include "shopcart.php";
  34. }
  35. else
  36. {
  37. echo "error";
  38. }
  39. break;
  40. }
  41. case 'remove';
  42. {
  43. $session_id = $_GET['sid'];
  44. $customer_id = $_GET['cid'];
  45. $product_id = $_GET['pid'];
  46.  
  47. $query = 'DELETE from cart where session_id = '$session_id' and customer_id = '$cust_id' and product_id = '$product_id'';
  48.  
  49. $result = mysqli_query ($conn, $query);
  50. $row = mysqli_affected_rows($conn);
  51.  
  52. if ($row > 0)
  53. {
  54. include "shopcart.php";
  55. }
  56. else
  57. {
  58. echo "error";
  59. }
  60. break;
  61. }
  62. }
  63.  
Runtime error #stdin #stdout 0.02s 13664KB
stdin
Standard input is empty
stdout
Parse error: syntax error, unexpected T_VARIABLE in /home/tbQQGp/prog.php on line 48