Advertisement
ShawnsSpace

testing pdo insert

Jan 22nd, 2014
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.55 KB | None | 0 0
  1.  // init your db here
  2. // set all parameters that will be inserted here staticly
  3.  
  4. $statement = $_local_connection->prepare("
  5.                  
  6.                   INSERT INTO  $takeaway_ordersssss_url
  7.                   (
  8.                       `user_id`,
  9.                       `user_ip`,
  10.                       `order_price`,
  11.                       `tax`,
  12.                       `shipping_cost`,
  13.                       `total_price`,
  14.                       `date`,
  15.                       `total_discount`,
  16.                       `payment_memo`,
  17.                       `pay_pal_fee`,
  18.                       `payment_option`,
  19.                       `requested_date`,
  20.                       `requested_time`,
  21.                       `randomer`
  22.                      
  23.                   ) VALUES (
  24.                      
  25.                       :user_id,
  26.                       :user_ip,
  27.                       :order_price,
  28.                       :tax,
  29.                       :shipping_cost,
  30.                       :total_price,
  31.                       :date,
  32.                       :total_discount,
  33.                       :payment_memo,
  34.                       :pay_pal_fee,
  35.                       :payment_option,
  36.                       :requested_date,
  37.                       :requested_time,
  38.                       :randomer
  39.  
  40.                   )
  41.                      
  42.               ");
  43.                        
  44.                 $insert_array=array(
  45.  
  46.                     ':user_id' => $user_details["id"],
  47.                     ':user_ip' => "$visitorip",
  48.                     ':order_price' => "",
  49.                     ':tax' => "$tax",
  50.                     ':shipping_cost' => "",
  51.                     ':total_price' => "$total_price",
  52.                     ':date' => time(),
  53.                     ':total_discount' => "$total_discount",
  54.                     ':payment_memo' => $this->_request_holder['params']["order_note"],
  55.                     ':pay_pal_fee' => "$pay_pal_fee",
  56.                     ':payment_option' => $this->_request_holder['params']["payment_option"],
  57.                     ':requested_date' => $this->_request_holder['params']["requested_date"],
  58.                     ':requested_time' => $this->_request_holder['params']["requested_time"],
  59.                     ':randomer' => $_SESSION["randomer"]
  60.                        
  61.                 );
  62.                
  63.                
  64.  
  65.                 $statement->execute($insert_array);
  66.                 $order_id=$_local_connection->lastInsertId();
  67.                 $statement->closeCursor();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement