Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2011
    Posts
    25
    Thanks
    5
    Thanked 0 Times in 0 Posts

    sql syntax error

    im having this sql syntax error please help.. thanks.






    -- -- Dumping data for table `orders_total` -- INSERT INTO `orders_total` (`orders_total_id`, `orders_id`, `title`, `text`, `value`, `class`, `sort_order`) VALUES (128, 42, 'Sub-Total:', 'S$400.00', 400.0000, 'ot_subtotal', 1), (129, 42, 'United Parcel Service (1 pkg x 0 kgs total) (UPS Worldwide Expedited (billed dimensional weight 1 KGS)):', 'S$52.86', 52.8600, 'ot_shipping', 2), (130, 42, 'Total:', 'S$452.86', 452.8600, 'ot_total', 4), (131, 43, 'Sub-Total:', 'S$0.00', 0.0000, 'ot_subtotal', 1), (132, 43, 'United Parcel Service (1 pkg x 0 kgs total) (UPS Worldwide Expedited (billed dimensional weight 1 KGS)):', 'S$51.26', 51.2600, 'ot_shipping', 2), (133, 43, 'Total:', 'S$51.26', 51.2600, 'ot_total', 4), (134, 44, 'Sub-Total:', 'S$560.00', 560.0000, 'ot_subtotal', 1), (135, 44, 'United Parcel Service (1 pkg x 6 kgs total) (UPS Worldwide Expedited (billed dimensional weight 6 KGS)):', 'S$130.78', 130.7800, 'ot_shipping', 2), (136, 44, 'Total:', 'S$690.78', 6[...]

    MySQL said:

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '&phpMyAdmin=csYR%2Chv-Yl6MyBs6oD%2CA9zB%2CTg7 'S$0.00', 0.0000, 'ot_shipping', 2' at line 206

  • #2
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,469
    Thanks
    71
    Thanked 104 Times in 103 Posts
    This is the wrong piece of code for the error. It's in the script. Post lines 180 - 215 please.

  • #3
    New Coder
    Join Date
    Aug 2011
    Posts
    25
    Thanks
    5
    Thanked 0 Times in 0 Posts
    im not sure what module or php file should i need to post.. this is the code from includes/classes/order.php



    PHP Code:

    <?php
      
    class order {
        var 
    $info$totals$products$customer$delivery$content_type;

        function 
    order($order_id '') {
          
    $this->info = array();
          
    $this->totals = array();
          
    $this->products = array();
          
    $this->customer = array();
          
    $this->delivery = array();

          if (
    tep_not_null($order_id)) {
            
    $this->query($order_id);
          } else {
            
    $this->cart();
          }
        }

        function 
    query($order_id) {
          global 
    $languages_id;

          
    $order_id tep_db_prepare_input($order_id);


          
    $order_query tep_db_query("select shipping_type, shipping_account, shipping_company, shipping_address, shipping_contact, shipping_email, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " TABLE_ORDERS " where orders_id = '" . (int)$order_id "'");
          
    $order tep_db_fetch_array($order_query);
          
          
    $worder_query tep_db_query("SELECT distinct p.products_id, p.products_weight, o.products_id, o.orders_id FROM products p, orders_products o WHERE p.products_id = o.products_id and o.orders_id = '" . (int)$order_id "'");
          
    $worder tep_db_fetch_array($worder_query);

          
    $totals_query tep_db_query("select title, text, class from " TABLE_ORDERS_TOTAL " where orders_id = '" . (int)$order_id "' order by sort_order");
          while (
    $totals tep_db_fetch_array($totals_query)) {
            
    $this->totals[] = array('title' => $totals['title'],
                                    
    'text' => $totals['text'],
                                    
    'sub' => $totals['class']);
          }

          
    $order_total_query tep_db_query("select text, value from " TABLE_ORDERS_TOTAL " where orders_id = '" . (int)$order_id "' and class = 'ot_total'");
          
    $order_total tep_db_fetch_array($order_total_query);
          
    $order_vtotal_query tep_db_query("select value from " TABLE_ORDERS_TOTAL " where orders_id = '" . (int)$order_id "' and class = 'ot_total'");
          
    $order_vtotal tep_db_fetch_array($order_vtotal_query);      
          
          
    $order_subtotal_query tep_db_query("select text from " TABLE_ORDERS_TOTAL " where orders_id = '" . (int)$order_id "' and class = 'ot_subtotal'");
          
          
    $order_subtotal tep_db_fetch_array($order_subtotal_query);     
          
          
    $order_shiptotal_query tep_db_query("select text from " TABLE_ORDERS_TOTAL " where orders_id = '" . (int)$order_id "' and class = 'ot_shipping'");
          
    $order_shiptotal tep_db_fetch_array($order_shiptotal_query);            

          
    $shipping_method_query tep_db_query("select title from " TABLE_ORDERS_TOTAL " where orders_id = '" . (int)$order_id "' and class = 'ot_shipping'");
          
    $shipping_method tep_db_fetch_array($shipping_method_query);

          
    $order_status_query tep_db_query("select orders_status_name from " TABLE_ORDERS_STATUS " where orders_status_id = '" $order['orders_status'] . "' and language_id = '" . (int)$languages_id "'");
          
    $order_status tep_db_fetch_array($order_status_query);


          
    $this->info = array('currency' => $order['currency'],
                              
    'currency_value' => $order['currency_value'],
                              
    'payment_method' => $order['payment_method'],
                              
    'cc_type' => $order['cc_type'],
                              
    'cc_owner' => $order['cc_owner'],
                              
    'cc_number' => $order['cc_number'],
                              
    'cc_expires' => $order['cc_expires'],
                              
    'date_purchased' => $order['date_purchased'],
                              
    'orders_status' => $order_status['orders_status_name'],
                              
    'last_modified' => $order['last_modified'],
                              
    'total' => strip_tags($order_total['text']),
                              
    'value' => strip_tags($order_total['value']),
                              
    'vtotal' => strip_tags($order_vtotal['value']),
                              
    'sub' => strip_tags($order_subtotal['text']),
                              
    'ship' => strip_tags($order_shiptotal['text']),
                              
    'xweight' => $worder['products_weight'],
                              
    'shipping_method' => $shipping_method['title']);

          
    $this->customer = array('name' => $order['customers_name'],
                                  
    'company' => $order['customers_company'],
                                  
    'street_address' => $order['customers_street_address'],
                                  
    'suburb' => $order['customers_suburb'],
                                  
    'city' => $order['customers_city'],
                                  
    'postcode' => $order['customers_postcode'],
                                  
    'state' => $order['customers_state'],
                                  
    'country' => array('title' => $order['customers_country']),
                                  
    'format_id' => $order['customers_address_format_id'],
                                  
    'telephone' => $order['customers_telephone'],
                                  
    'email_address' => $order['customers_email_address']);

          
    $this->delivery = array('name' => trim($order['delivery_name']),
                                  
    'company' => $order['delivery_company'],
                                  
    'street_address' => $order['delivery_street_address'],
                                  
    'suburb' => $order['delivery_suburb'],
                                  
    'city' => $order['delivery_city'],
                                  
    'postcode' => $order['delivery_postcode'],
                                  
    'state' => $order['delivery_state'],
                                  
    'shipping_type' => $order['shipping_type'],
                                  
    'shipping_account' => $order['shipping_account'],
                                  
    'shipping_company' => $order['shipping_company'],
                                  
    'shipping_address' => $order['shipping_address'],
                                  
    'shipping_contact' => $order['shipping_contact'],
                                  
    'shipping_email' => $order['shipping_email'],
                                  
    'country' => array('title' => $order['delivery_country']),
                                  
    'format_id' => $order['delivery_address_format_id']);

          if (empty(
    $this->delivery['name']) && empty($this->delivery['street_address'])) {
            
    $this->delivery false;
          }

          
    $this->billing = array('name' => $order['billing_name'],
                                 
    'company' => $order['billing_company'],
                                 
    'street_address' => $order['billing_street_address'],
                                 
    'suburb' => $order['billing_suburb'],
                                 
    'city' => $order['billing_city'],
                                 
    'postcode' => $order['billing_postcode'],
                                 
    'state' => $order['billing_state'],
                                 
    'country' => array('title' => $order['billing_country']),
                                 
    'format_id' => $order['billing_address_format_id']);

          
    $index 0;
          
    $orders_products_query tep_db_query("select p.total, p.orders_products_id, p.products_id, p.products_name, p.products_model, p.products_price, p.products_tax, p.products_quantity, p.final_price, c.products_id, c.products_weight from " TABLE_ORDERS_PRODUCTS " p,  " TABLE_PRODUCTS " c where p.products_id = c.products_id and orders_id = '" . (int)$order_id "'");
          while (
    $orders_products tep_db_fetch_array($orders_products_query)) {
            
    $this->products[$index] = array('qty' => $orders_products['products_quantity'],
                                            
    'weight' => $orders_products['products_weight'],
                                            
    'id' => $orders_products['products_id'],
                                            
    'jid' => $orders_products['orders_products_id'],
                                            
    'name' => $orders_products['products_name'],
                                            
    'total' => $orders_products['total'],
                                            
    'model' => $orders_products['products_model'],
                                            
    'tax' => $orders_products['products_tax'],
                                            
    'price' => $orders_products['products_price'],
                                            
    'final_price' => $orders_products['final_price']);

            
    $subindex 0;
    $attributes_query tep_db_query("select  products_options, products_options_values, products_options_values_code, options_values_price, price_prefix from " TABLE_ORDERS_PRODUCTS_ATTRIBUTES " where orders_id = '" . (int)$order_id "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");


                
            if (
    tep_db_num_rows($attributes_query)) {
              while (
    $attributes tep_db_fetch_array($attributes_query)) {
                
    $this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
                                                                         
    'value' => $attributes['products_options_values'],
                                                                        
    'code' => $attributes['products_optionsa_values_code'],                                                                
                                                                         
    'attw' => (int)$products[$i]['id'],
                                                                         
    'prefix' => $attributes['price_prefix'],
                                                                         
    'price' => $attributes['options_values_price']);

                
    $subindex++;
              }
            }

            
    $this->info['tax_groups']["{$this->products[$index]['tax']}"] = '1';

            
    $index++;
          }
        }

        function 
    cart() {
          global 
    $HTTP_POST_VARS$customer_id$sendto$billto$cart$languages_id$currency$currencies$shipping$payment$comments$customer_default_address_id;

          
    $this->content_type $cart->get_content_type();

          if ( (
    $this->content_type != 'virtual') && ($sendto == false) ) {
            
    $sendto $customer_default_address_id;
          }

          
    $customer_address_query tep_db_query("select c.shipping_type, c.shipping_account, c.shipping_company, c.shipping_address, c.shipping_contact, c.shipping_email, c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.address_book_id, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " TABLE_CUSTOMERS " c, " TABLE_ADDRESS_BOOK " ab left join " TABLE_ZONES " z on (ab.entry_zone_id = z.zone_id) left join " TABLE_COUNTRIES " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int)$customer_id "' and ab.customers_id = '" . (int)$customer_id "' and c.customers_default_address_id = ab.address_book_id");
          
    $customer_address tep_db_fetch_array($customer_address_query);

          if (
    is_array($sendto) && !empty($sendto)) {
            
    $shipping_address = array('entry_firstname' => $sendto['firstname'],
                                      
    'entry_lastname' => $sendto['lastname'],
                                      
    'entry_company' => $sendto['company'],
                                      
    'entry_street_address' => $sendto['street_address'],
                                      
    'entry_suburb' => $sendto['suburb'],
                                      
    'entry_postcode' => $sendto['postcode'],
                                      
    'entry_city' => $sendto['city'],
                                      
    'entry_zone_id' => $sendto['zone_id'],
                                      
    'zone_name' => $sendto['zone_name'],
                                      
    'entry_country_id' => $sendto['country_id'],
                                      
    'countries_id' => $sendto['country_id'],
                                      
    'countries_name' => $sendto['country_name'],
                                      
    'countries_iso_code_2' => $sendto['country_iso_code_2'],
                                      
    'countries_iso_code_3' => $sendto['country_iso_code_3'],
                                      
    'address_format_id' => $sendto['address_format_id'],
                                      
    'entry_state' => $sendto['zone_name']);
          } elseif (
    is_numeric($sendto)) {
            
    $shipping_address_query tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " TABLE_ADDRESS_BOOK " ab left join " TABLE_ZONES " z on (ab.entry_zone_id = z.zone_id) left join " TABLE_COUNTRIES " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id "' and ab.address_book_id = '" . (int)$sendto "'");
            
    $shipping_address tep_db_fetch_array($shipping_address_query);
          } else {
            
    $shipping_address = array('entry_firstname' => null,
                                      
    'entry_lastname' => null,
                                      
    'entry_company' => null,
                                      
    'entry_street_address' => null,
                                      
    'entry_suburb' => null,
                                      
    'entry_postcode' => null,
                                      
    'entry_city' => null,
                                      
    'entry_zone_id' => null,
                                      
    'zone_name' => null,
                                      
    'entry_country_id' => null,
                                      
    'countries_id' => null,
                                      
    'countries_name' => null,
                                      
    'countries_iso_code_2' => null,
                                      
    'countries_iso_code_3' => null,
                                      
    'address_format_id' => 0,
                                      
    'entry_state' => null);
          }

          if (
    is_array($billto) && !empty($billto)) {
            
    $billing_address = array('entry_firstname' => $billto['firstname'],
                                     
    'entry_lastname' => $billto['lastname'],
                                     
    'entry_company' => $billto['company'],
                                     
    'entry_street_address' => $billto['street_address'],
                                     
    'entry_suburb' => $billto['suburb'],
                                     
    'entry_postcode' => $billto['postcode'],
                                     
    'entry_city' => $billto['city'],
                                     
    'entry_zone_id' => $billto['zone_id'],
                                     
    'zone_name' => $billto['zone_name'],
                                     
    'entry_country_id' => $billto['country_id'],
                                     
    'countries_id' => $billto['country_id'],
                                     
    'countries_name' => $billto['country_name'],
                                     
    'countries_iso_code_2' => $billto['country_iso_code_2'],
                                     
    'countries_iso_code_3' => $billto['country_iso_code_3'],
                                     
    'address_format_id' => $billto['address_format_id'],
                                     
    'entry_state' => $billto['zone_name']);
          } else {
            
    $billing_address_query tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " TABLE_ADDRESS_BOOK " ab left join " TABLE_ZONES " z on (ab.entry_zone_id = z.zone_id) left join " TABLE_COUNTRIES " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id "' and ab.address_book_id = '" . (int)$billto "'");
            
    $billing_address tep_db_fetch_array($billing_address_query);
          }



    ?>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •