Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2006
    Posts
    149
    Plugin Contributions
    1

    Default PHP Fatal Error 1054:Unknown column

    I've searched for those words in this forum and didn't come up with any results.

    In the debug log:

    [20-Dec-2012 09:29:51] PHP Fatal error: 1054:Unknown column 'products_length' in 'field list' :: SELECT products_length, products_width, products_height, products_ready_to_ship, product_is_always_free_shipping, products_weight FROM znc_products WHERE products_id = 297 LIMIT 1 in /home7/allmakes/public_html/includes/classes/db/mysql/query_factory.php on line 120

    Then I added strict error reporting and got this message:

    1054 Unknown column 'products_length' in 'field list'
    in:
    [SELECT products_length, products_width, products_height, products_ready_to_ship, product_is_always_free_shipping, products_weight FROM znc_products WHERE products_id = 698 LIMIT 1]

    I promptly disabled strict error reporting after that to keep the site safe.

    I am assuming, and let me know if I am wrong, that this may be a database issue? Please let me know what I should do next.

    I'd really appreciate some direction to go in on this one. I've had a problem actually going in phpMyAdmin and snooping around, so I had to contact the host.

    Thanks very much,
    webmiss

  2. #2
    Join Date
    Jun 2005
    Location
    Cumbria, UK
    Posts
    10,263
    Plugin Contributions
    3

    Default Re: PHP Fatal Error 1054

    The error is telling you exactly what the problem is...

    Unknown column 'products_length'

    Now... product length is not a CORE zencart data set. It must come from something you have added.

    You need to go through what you added, and unpick it.
    20 years a Zencart User

  3. #3
    Join Date
    Jan 2004
    Posts
    66,374
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: PHP Fatal Error 1054

    schoolboy is right.

    You've got PHP files on your site that are looking for fields in the database that aren't in the database. That's because you've changed the PHP files, probably by adding files for plugins, but you haven't completed the rest of the install of that plugin by doing the database portion.
    .

    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
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: PHP Fatal Error 1054:Unknown column

    Quote Originally Posted by webmiss View Post
    1054 Unknown column 'products_length' in 'field list'
    This is indicative that at some stage or other you've installed or attempted to install one of these modules:
    ozpost
    austpost
    canadapost
    (possibly others).

    ... and the installation either wasn't completed (the database wasn't updated), OR, if the module(s) was successfully installed and you've attempted to uninstall it, but in doing so you have neglected to restore the changed files in the /admin/ folder(s).

    If you happen to be using ozpost V3.x.x you are not likely to suffer any of these issues because the install/remove scripts eliminate the need for manual manipulation of the /admin/ files. However, if the problem *does* appear with this module version (which can occur if the store database gets restored from a backup that is older than the store files) the cure is very simple. Click the 'remove' button to uninstall ozpost V3.x.x then immediately click the 'install' button to re-install. This process will both recreate the missing database records AND update the /admin/ files for you at the same time.

    If using one of the other modules, there are two possible fixes.
    1. Complete the installation. This will usually mean that you need to run an SQL script to create the database records.
    2. Complete the uninstall. This will involve restoring the changed files in your /admin/ folder with those from the original zencart files.

    Cheers
    Rod
    Last edited by RodG; 22 Dec 2012 at 04:19 AM.

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: PHP Fatal Error 1054:Unknown column

    ps: Here's the SQL command you'll need to re-add the missing database records.

    Code:
    ALTER TABLE `products` ADD `products_length` FLOAT(6,2) NULL AFTER `products_weight`
    , ADD `products_height` FLOAT(6,2) NULL AFTER `products_length`, ADD `products_width` FLOAT(6,2) NULL AFTER `products_height` ;
    Note: you may need to change `products` to `zen_products` or similar (depends on your store). Either way, just make sure the table names match. OK?
    (only the one in red text will need to be changed)

    Cheers
    Rod.

    ps. If you run this SQL on an already updated database it will produce an error message that can simply be ignored.
    pss. It is safe to run this command even if you have no use or need for the dimension data.
    psss. There is never a need to delete these records even if the module(s) that use(d) them are removed (in fact doing so is often the cause of the problem you are currently experiencing).

  6. #6
    Join Date
    Jan 2004
    Posts
    66,374
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: PHP Fatal Error 1054:Unknown column

    Keep in mind that there might be many other additional database alterations necessary to support the plugin code your store contains. Running that single statement mentioned above will not handle all the other requirements of the module. A proper install or uninstall of the module is the correct solution to your problem
    .

    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.

  7. #7
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: PHP Fatal Error 1054:Unknown column

    Quote Originally Posted by DrByte View Post
    Keep in mind that there might be many other additional database alterations necessary to support the plugin code your store contains. Running that single statement mentioned above will not handle all the other requirements of the module. A proper install or uninstall of the module is the correct solution to your problem
    You bugger. I was about to ask you 'what other additional database alterations'? (being quite confident that none of the ozpost/austpost modules make any other changes, and the last time I checked, the canadapost module only made the same changes as ozpost), so I thought I'd better take another look so as to not embarrass myself again <g>.

    I now see that you have managed to become a/the maintainer of this code and have made a number of changes (including to the database), so once again I stand corrected, the code snippet I provided will not be suitable fix for the Canadapost module.

    Thankfully, it'll still cause no harm if someone runs it anyway. but best they don't.

    Cheers
    Rod

  8. #8
    Join Date
    Feb 2006
    Posts
    149
    Plugin Contributions
    1

    Default Re: PHP Fatal Error 1054:Unknown column

    Okay, thanks for all the feedback. I'll have to look and see if there are any other plugins that were added.

    webmiss

  9. #9
    Join Date
    Feb 2006
    Posts
    149
    Plugin Contributions
    1

    Default Re: PHP Fatal Error 1054:Unknown column

    Found the culprit. It was the fedex shipping module. I went to check on this plugin again and it says it is for the 1.3.8 version. I have installed the zencart 1.5.1 version. So, I need to uninstall this shipping module. Also, I didn't see any sql files to go with this module. Do any of the other fedex shipping mods offer ground and express shipping do you know for zencart version 1.5.1?

    Thanks to all of you for your input, feedback and direction. I will get this fixed. Each of you are awesome.

    Have a very Merry Christmas to everyone on the zencart team and all those of you who have contributed by way of plugins and on these support forums.

  10. #10
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: PHP Fatal Error 1054:Unknown column

    Quote Originally Posted by webmiss View Post
    Found the culprit. It was the fedex shipping module.
    Thanks. I'll add this one to my list of modules that add the dimensional data.

    Cheers
    Rod

 

 

Similar Threads

  1. v151 Fatal error: 1054:Unknown column 'gzpost' in 'field list'
    By dellaenterprises in forum Upgrading to 1.5.x
    Replies: 11
    Last Post: 22 Jan 2013, 12:29 AM
  2. 1054 Unknown column error
    By godin5150 in forum General Questions
    Replies: 3
    Last Post: 30 Sep 2008, 06:03 AM
  3. 1054 Unknown column ERROR
    By TripleMoons in forum Upgrading from 1.3.x to 1.3.9
    Replies: 4
    Last Post: 25 Apr 2008, 09:43 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR