Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2009
    Posts
    15
    Plugin Contributions
    0

    Default 1064 You have an error in your SQL syntax

    I have added additional fields to my product description pages. When I update the product i get the following message:

    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 'usage =


    I have run an error check and it gives me this:

    PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/irrigat2/public_html/tomatopedia.com/admin/includes/modules/product/collect_info.php on line 60

    Here is the code:

    The area highlighted in red is where the alleged error is.
    The blue highlighted text is what I have added.

    I used the following thread to achieve do this:
    http://www.zen-cart.com/forum/showth...roduct+details


    'products_sort_order' => '0',
    'products_discount_type' => '0',
    'products_discount_type_from' => '0',
    'products_price_sorter' => '0',
    'master_categories_id' => '0',
    'colour' => '0',
    'sun_exposure'=> '0',
    'fruit_weight'=> '0',
    'resistance'=> '0',
    'shape' => '0',
    'habitat' => '0',
    'growing_conditions' => '0',
    'maturity' => '0',
    'usage' => '0',
    'seed' => '0',
    'plant_height' => '0',
    'plant_spacing' => '0',
    'a_k_a' => '0',
    'history_description' => '0',
    'fruit_description' => '0',
    'plant_description' => '0',
    'family' => '0',
    'genus' => '0',
    'species' => '0'

    );

    $pInfo = new objectInfo($parameters);

    if (isset($_GET['pID']) && empty($_POST)) {
    $product = $db->Execute("select pd.products_name, pd.products_description, pd.products_url,
    p.products_id, p.products_quantity, p.products_model,
    p.products_image, p.products_price, p.products_virtual, p.products_weight,
    p.products_date_added, p.products_last_modified,
    date_format(p.products_date_available, '%Y-%m-%d') as
    products_date_available, p.products_status, p.products_tax_class_id,
    p.manufacturers_id,
    p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
    p.product_is_free, p.product_is_call, p.products_quantity_mixed,
    p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max,
    p.products_sort_order,
    p.products_discount_type, p.products_discount_type_from,
    p.products_price_sorter, p.master_categories_id,
    p.colour, p.sun_exposure, p.fruit_weight, p.resistance, p.shape, p.habitat, p.growing_conditions, p.maturity, p.usage, p.seed, p.plant_height, p.plant_spacing, p.a_k_a, p.history_description, p.fruit_description, p.plant_description, p.family, p.genus, p.species
    from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
    where p.products_id = '" . (int)$_GET['pID'] . "'
    and p.products_id = pd.products_id
    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");

  2. #2
    Join Date
    Feb 2009
    Posts
    15
    Plugin Contributions
    0

    Default Re: 1064 You have an error in your SQL syntax

    This is totally confusing me. The problem is fixed if I remove 'usage' => '0', and , p.usage. But, when I replace them, back comes the problem. Anybody any ideas?

  3. #3
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    934
    Plugin Contributions
    9

    Default Re: 1064 You have an error in your SQL syntax

    Maybe try this in the original blue highlighted code:

    species' => '0',
    );

  4. #4
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: 1064 You have an error in your SQL syntax

    Two possibilities - no guarantee for either ... either you don't have a column called "usage" in your products table, or "usage" is a reserved word in MySQL which is trying to interpret is as something other than a column name.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  5. #5
    Join Date
    Jun 2007
    Location
    Bronx, New York, United States
    Posts
    934
    Plugin Contributions
    9

    Default Re: 1064 You have an error in your SQL syntax

    Quote Originally Posted by kuroi View Post
    Two possibilities - no guarantee for either ... either you don't have a column called "usage" in your products table, or "usage" is a reserved word in MySQL which is trying to interpret is as something other than a column name.
    Should've thought of that one...

    USAGE is indeed a reserved word of MySQL. You can work around this by placing all calls to the usage column in quotes. For example `usage` or 'usage'.

    Reference, MYSQL Reserved Words as listed in section 8.3 of the manual:
    http://dev.mysql.com/doc/refman/5.1/...ved-words.html

    However for simplicity, it's suggested you add something to the usage name like s_usage or fruit_usage of the sort.

 

 

Similar Threads

  1. 1064 You have an error in your SQL syntax
    By Delights in forum Installing on a Linux/Unix Server
    Replies: 1
    Last Post: 8 Aug 2010, 10:06 PM
  2. 1064 You have an error in your SQL syntax;
    By ndr2010 in forum General Questions
    Replies: 10
    Last Post: 19 Apr 2010, 08:36 PM
  3. 1064 You have an error in your SQL syntax;
    By fried83 in forum Bug Reports
    Replies: 5
    Last Post: 15 Aug 2007, 11:51 PM
  4. 1064 You have an error in your SQL syntax
    By techie in forum Basic Configuration
    Replies: 1
    Last Post: 13 May 2006, 03:53 PM

Posting Permissions

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