Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Jul 2005
    Posts
    31
    Plugin Contributions
    0

    Default Uknown Column when making heavy mods to code

    I keep getting this message in admin.

    i changed the mysql field type for product from int to varchar and as far as i can see from the code it is still looking for an int how can i fix this.

    1054 Unknown column 'D' in 'where clause'
    in:
    [select * from products_to_categories where product_id=0000762-D]
    If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

    also get simualar when i click on a cat in admin.

  2. #2
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: Uknown Column

    A lot of the queries to the database use the form
    Code:
    products_id = (int)$products_id
    when selecting data: that's where your problem is.

    Changing the field type for the product_id means you'd have to modify a huge number of queries throughout the site.
    Neville
    An assumption is what you arrive at when you get tired of thinking...

  3. #3
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Uknown Column

    "huge number of queries" is an understatement.

    products_id is a numeric value that is used as a cross-reference value (key) to link numerous database tables together.

    You'd be better off using the products_model field to track the varchar-style product number instead of the products_id field.
    .
    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Jul 2005
    Posts
    31
    Plugin Contributions
    0

    Default Re: Uknown Column

    ok well i have changed every line of query so that it doesnt use int anymore.

    the only problem i now have is when i click on a product that has a product_id of 0002249-C it will remove the -C from the url so it wont work, uet everything in admin works fine

  5. #5
    Join Date
    Jul 2005
    Posts
    31
    Plugin Contributions
    0

    Default Re: Uknown Column

    fixed by removing this line in init_sanitize.php

    if (isset($_GET['sku_id'])) $_GET['sku_id'] = ereg_replace('[^0-9a-f:]', '', $_GET['sku_id']);

 

 

Similar Threads

  1. Making postal code NOT REQUIRED
    By mamashop in forum Customization from the Admin
    Replies: 6
    Last Post: 19 May 2011, 08:00 AM
  2. Making mods available to the ZC community that you paid for
    By heimskr75 in forum General Questions
    Replies: 5
    Last Post: 6 Mar 2008, 05:06 AM
  3. making the column display look better
    By tjthecat3 in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 13 Jan 2008, 08:33 AM
  4. code change for when recently viewed and msrp mods are used together
    By lankeeyankee in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 7 Nov 2007, 02:44 AM
  5. Making an EZ-page with PHP code?
    By emilfalcon in forum General Questions
    Replies: 7
    Last Post: 12 Oct 2007, 04:29 AM

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