Forums / Templates, Stylesheets, Page Layout / Unknown Error On Category Pages

Unknown Error On Category Pages

Views: 771

Results 1 to 7 of 7
30 Apr 2015, 2:45 AM
#1
dk_scully avatar

dk_scully

Zen Follower

Join Date:
Jan 2011
Posts:
339
Plugin Contributions:
0

Unknown Error On Category Pages

I'm having a small problem with https://www.jogrant.com. The index page looks great. The individual story listings look great. The three category pages are not displaying quite accurately...the descriptions are extending into the right sidebar (which is empty), and this message is appearing at the bottom of the pages: WARNING: An Error occurred, please refresh the page and try again.

Refreshing the pages doesn't help. The error log baffles me; I can't figure out where the error is. It says:

[29-Apr-2015 21:46:00 America/Chicago] PHP Fatal error: 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 'from products p, products_description pd
where p.products_id = pd.p' at line 3 :: select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
p.products_date_added, p.products_price, p.products_type, p.master_categories_id ,pd.products_description from products p, products_description pd
from products p, products_description pd
where p.products_id = pd.products_id
and pd.language_id = '1'
and p.products_status = 1 order by rand()
and p.products_id in (1, 2) ==> (as called by) /home2/boruma/public_html/jogrant.com/includes/modules/new_products.php on line 50 <== in /home2/boruma/public_html/jogrant.com/includes/classes/db/mysql/query_factory.php on line 155

Anyone have any ideas? :lookaroun Thanks!!

30 Apr 2015, 2:56 AM
#2
dk_scully avatar

dk_scully

Zen Follower

Join Date:
Jan 2011
Posts:
339
Plugin Contributions:
0

Re: Unknown Error On Category Pages

This is the code I've been using on several different websites, and it's worked perfectly until now. That's why I'm confused...why is it suddenly malfunctioning now?

$new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
p.products_date_added, p.products_price, p.products_type, p.master_categories_id ,pd.products_description from " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_status = 1 order by rand()
and p.products_id in (" . $list_of_products . ")";

30 Apr 2015, 7:10 AM
#3
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Re: Unknown Error On Category Pages

DK_Scully:

This is the code I've been using on several different websites, and it's worked perfectly until now. That's why I'm confused...why is it suddenly malfunctioning now?

$new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
p.products_date_added, p.products_price, p.products_type, p.master_categories_id ,pd.products_description from " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_status = 1 order by rand()
and p.products_id in (" . $list_of_products . ")";

That code looks wrong the from statement is repeated

Webzings Design
Semi retired from Web Design

30 Apr 2015, 12:09 PM
#4
dk_scully avatar

dk_scully

Zen Follower

Join Date:
Jan 2011
Posts:
339
Plugin Contributions:
0

Re: Unknown Error On Category Pages

What I did was copy the new_products.php file from another site that was working properly, and uploaded it directly to this new site. Why would it work on several other sites, but not on this one? What would cause the code to suddenly double?

I did a direct side-by-side comparison of the code used on the other sites...where it's working properly...and this site where it's not. The code is identical.

30 Apr 2015, 10:47 PM
#5
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Re: Unknown Error On Category Pages

I don't know why it would change, but that change with the duplicate from statement would give that error

$new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
p.products_date_added, p.products_price, p.products_type, p.master_categories_id ,pd.products_description
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_status = 1 order by rand()
and p.products_id in (" . $list_of_products . ")";

Perhaps delete the file on the server and confirm its deleted by requesting the page that uses it, and then upload the new one that you know works.

If that doesn't work

Go into your hosting control panels file manager, open the file and check the code is correct within the file there

$new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
p.products_date_added, p.products_price, p.products_type, p.master_categories_id ,pd.products_description
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_status = 1 order by rand()
and p.products_id in (" . $list_of_products . ")";

Webzings Design
Semi retired from Web Design

1 May 2015, 1:13 AM
#6
dk_scully avatar

dk_scully

Zen Follower

Join Date:
Jan 2011
Posts:
339
Plugin Contributions:
0

Re: Unknown Error On Category Pages

No, I guess I didn't explain myself well enough. The code above is working perfectly on 8 other shopping carts. That exact code, with the apparent duplication in it. I will do as you recommended, and delete the file and then re-upload it...but why would it be working perfectly well on 8 other sites if there's bad code in it?

1 May 2015, 1:59 AM
#7
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Re: Unknown Error On Category Pages

Don't know why, but i can confirm that if I duplicate that particular line in my code on the new_products page I get that same issue and the same error log

[30-Apr-2015 21:47:16] PHP Fatal error:  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 'from znc_products p, znc_products_description pd
where p.products_id = pd.produc' at line 3 :: select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
p.products_date_added, p.products_price, p.products_type, p.master_categories_id ,pd.products_description from znc_products p, znc_products_description pd
from znc_products p, znc_products_description pd
where p.products_id = pd.products_id
and pd.language_id = '1'
and p.products_status = 1 order by rand()
and p.products_id in (1, 2, 3) in /path to queryfactory thingie

If I remove the duplicated line as below

$new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
p.products_date_added, p.products_price, p.products_type, p.master_categories_id ,pd.products_description
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
and p.products_status = 1 order by rand()
and p.products_id in (" . $list_of_products . ")";

my page show like this (which i assume is correct?)

I get new product appearing below the listing and no error message

http://www.grumpykiwi.com//index.php?main_page=index&cPath=1

Webzings Design
Semi retired from Web Design