Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Location
    United States
    Posts
    28
    Plugin Contributions
    0

    Default php warning and SQL syntax error [1.3.5]

    Whenever I try to view the products by manufacturers ("index.php?main_page=index&manufacturers_id=X") I get the following:

    Code:
    Warning: constant() [function.constant]: Couldn't find constant in <MY_STORE>/includes/init_includes/init_add_crumbs.php on line 45
    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 where manufacturers_id = 1' at line 2
    in:
    [select from where manufacturers_id = 1]
    Lines 35 through 48 of that file:

    PHP Code:
    /**
     * split to add manufacturers_name to the display
     */
    if (isset($_GET['manufacturers_id'])) {
      
    $manufacturers_query "select manufacturers_name
                                from " 
    TABLE_MANUFACTURERS "
                                where manufacturers_id = '" 
    . (int)$_GET['manufacturers_id'] . "'";

      
    $manufacturers $db->Execute($manufacturers_query);

      if (
    $manufacturers->RecordCount() > 0) {
        
    $breadcrumb->add($manufacturers->fields['manufacturers_name'], zen_href_link(FILENAME_DEFAULT'manufacturers_id=' $_GET['manufacturers_id']));
      }

    Heres is some info about my server and stuff.

    Database: MySQL 5.0.18-standard-log

    HTTP Server: Apache/2.0.54 (Unix) PHP/4.4.2 mod_ssl/2.0.54 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.1.4

    PHP Version: 5.1.2 (Zend: 2.1.0)

    Zen Cart 1.3.5
    Database Patch Level: 1.3.5

    Ask if you need more. I really want to fix this problem.

  2. #2
    Join Date
    Aug 2006
    Location
    United States
    Posts
    28
    Plugin Contributions
    0

    Default Re: php warning and SQL syntax error [1.3.5]

    Until a fix is found I'm just going to change the query to

    PHP Code:
    $sql "select manufacturers_name
                    from zen_manufacturers
                    where manufacturers_name =  " 
    . (int)$_GET[$get_terms->fields['get_term_name']]; 

    Also, the advanced search does not work.
    Code:
    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 '' at line 10
    in:
    [select count(distinct p.products_id) as total FROM zen_products p LEFT JOIN zen_manufacturers m USING(manufacturers_id), zen_products_description pd, zen_categories c, zen_products_to_categories p2c LEFT JOIN zen_meta_tags_products_description mtpd ON mtpd.products_id= p2c.products_id AND mtpd.language_id = 1 WHERE (p.products_status = 1 AND p.products_id = pd.products_id AND pd.language_id = 1 AND p.products_id = p2c.products_id AND p2c.categories_id = c.categories_id AND m.manufacturers_id = 2]
    Last edited by helmetman; 13 Oct 2006 at 10:11 PM.

  3. #3
    Join Date
    Aug 2004
    Location
    Saint Petersburg, Russia
    Posts
    1,786
    Plugin Contributions
    13

    Default Re: php warning and SQL syntax error [1.3.5]

    Quote Originally Posted by helmetman View Post
    Also, the advanced search does not work.
    Code:
    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 '' at line 10
    in:
    [select count(distinct p.products_id) as total FROM zen_products p LEFT JOIN zen_manufacturers m USING(manufacturers_id), zen_products_description pd, zen_categories c, zen_products_to_categories p2c LEFT JOIN zen_meta_tags_products_description mtpd ON mtpd.products_id= p2c.products_id AND mtpd.language_id = 1 WHERE (p.products_status = 1 AND p.products_id = pd.products_id AND pd.language_id = 1 AND p.products_id = p2c.products_id AND p2c.categories_id = c.categories_id AND m.manufacturers_id = 2]
    split_page_results class error

  4. #4
    Join Date
    Aug 2006
    Location
    United States
    Posts
    28
    Plugin Contributions
    0

    Default Re: php warning and SQL syntax error [1.3.5]

    Quote Originally Posted by a_berezin View Post

    This did not work.

  5. #5
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: php warning and SQL syntax error [1.3.5]

    You might wish to look at the bug fixes for v1.3.5 that are posted on this bugfix thread:

    http://www.zen-cart.com/forum/showthread.php?t=45377
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. v151 PHP Fatal error: 1064:You have an error in your SQL syntax
    By chaptech in forum General Questions
    Replies: 2
    Last Post: 5 Mar 2015, 07:16 PM
  2. PHP Fatal error: 1064:You have an error in your SQL syntax
    By uswebworx in forum General Questions
    Replies: 11
    Last Post: 19 Apr 2012, 09:17 AM
  3. Replies: 1
    Last Post: 25 Aug 2011, 05:58 AM
  4. Blank page and PHP Parse error: syntax error
    By Spiritus in forum General Questions
    Replies: 8
    Last Post: 17 Mar 2010, 07:16 PM
  5. SQL Syntax error: check for right syntax to use near '000000
    By gabyone in forum General Questions
    Replies: 2
    Last Post: 9 Feb 2008, 08:23 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