Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Sep 2013
    Location
    Norway
    Posts
    3
    Plugin Contributions
    0

    Default 1109 Unknown table 'p' in field list

    I’m using Zen Cart 1.39h and have problems with displaying the specials function. I’m also using a template..

    http://masked/index.php?main_page=specials

    Click image for larger version. 

Name:	zen1.png 
Views:	118 
Size:	6.8 KB 
ID:	13058
    I’ve enabled logging on MySQL and extracted the query in question from general_log.csv :

    SELECT p.products_id, p.products_image, pd.products_name, p.master_categories_id
    FROM (products p LEFT JOIN specials s on p.products_id = s.products_id LEFT JOIN products_description pd on p.products_id = pd.products_id )
    WHERE p.products_id = s.products_id and p.products_id = pd.products_id and p.products_status = '1'
    AND s.status = 1
    AND pd.language_id = 1
    ORDER BY s.specials_date_added DESC limit 12

    When I run this query in phpMyAdmin, it runs perfectly:
    Click image for larger version. 

Name:	zen2.png 
Views:	92 
Size:	7.5 KB 
ID:	13059


    I’m not sure which php-file which is in use when this query is executed on the web, but it seems like something with the query within the php-file malfunctions..
    Could anyone please help?

    Thanks,
    Dex
    Last edited by Dexter71; 12 Sep 2013 at 05:44 PM.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: 1109 Unknown table 'p' in field list

    You're talking about 2 different queries.

    The first, with the error, is "SELECT count(p.products_id) as total". Note how it's missing any mention of table names, let alone a tablename alias of "p" to match a table name.

    The second query you posted does indeed work correctly, primarily because it's a complete query.


    Your first query is probably a pagination check, to see whether controls need to be added to the page to allow the visitor to click to more pages of results.

    In a default uncustomized unaltered ZC install, using the original template, the pagination is handled by calls to a split_page_results class object. This involves some PHP code in the template files to determine whether to display the controls, and what part to display. It also involves some PHP code in the corresponding modules/pages files to determine which subset of results are being requested. And then once those pieces are determined it then will run the actual real original query (ie: your 2nd one) to extract the actual results.

    So, your symptoms could be a result of many things, including but not limited to:
    - someone has tampered with the split_page_results class
    - someone has altered the code in the modules/pages/specials/ files (you said this was happening on the specials page)
    - someone has altered the code in the template files related to specials (or whatever templates are involved in whatever page you're getting the error on)
    - plugins you've installed
    .

    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.

  3. #3
    Join Date
    Sep 2013
    Location
    Norway
    Posts
    3
    Plugin Contributions
    0

    Default Re: 1109 Unknown table 'p' in field list

    Thanks for the reply DrByte. I think you put me on the right path . I replaced the tpl_specials_default.php in my template with the original file, and it seems to have done the trick! I'll just check it further and get back here if I have any follow-up questions.

 

 

Similar Threads

  1. v154 PHP Fatal error: 1109: Unknown table 'p' in field list
    By bobc in forum General Questions
    Replies: 24
    Last Post: 20 Jan 2017, 06:06 PM
  2. v154 What does this mean? 1109:Unknown table 'p' in field list
    By robbin21973 in forum General Questions
    Replies: 13
    Last Post: 18 Sep 2015, 07:00 AM
  3. Product Filter Module - 1109:Unknown table 'p' in field list
    By moesoap in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 28 May 2012, 01:40 PM
  4. Replies: 12
    Last Post: 3 Mar 2009, 03:27 AM
  5. Links manager error 1109 Unknown table 'p' in field list
    By ctcentralinfo in forum General Questions
    Replies: 7
    Last Post: 27 Sep 2006, 10:10 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