Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL Error for print catalog


211655

Recommended Posts

Hi,

i am using the contribution:

"adding a print catalog" i m using 2.2MS

 

i get this error when i run the file:

 

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 'select p.products_id, pd.products_name, pd.products_descrip

select count(select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, cd.categories_name, m.manufacturers_name from products p left join products_to_categories p2c on p.products_id=p2c.products_id left join categories c on p2c.categories_id=c.categories_id left join categories_description cd on c.parent_id=\'0\' and c.categories_id=cd.categories_id left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join products_description pd on p.products_id = pd.products_id and pd.language_id = \'1\' left join specials s on p.products_id = s.products_id where products_status = \'1\' order by cd.categories_name, c.parent_id, c.sort_order, c.categories_id, pd.products_name) as total

 

i have some new fields like catalog description and prodict short info in db. rest is sam eexept some changes in the sizes of some fields.

thanks

Link to comment
Share on other sites

I don't have this contribution, but to me it looks like your sql should have been like this:

 

select count(*) as total, p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, cd.categories_name, m.manufacturers_name from products p left join products_to_categories p2c on p.products_id=p2c.products_id left join categories c on p2c.categories_id=c.categories_id left join categories_description cd on c.parent_id=\'0\' and c.categories_id=cd.categories_id left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join products_description pd on p.products_id = pd.products_id and pd.language_id = \'1\' left join specials s on p.products_id = s.products_id where products_status = \'1\' order by cd.categories_name, c.parent_id, c.sort_order, c.categories_id, pd.products_name

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

still got thsi 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 'select count(*) as total, p.products_id, pd.products_name, pd.p

select count(select count(*) as total, p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, cd.categories_name, m.manufacturers_name from products p left join products_to_categories p2c on p.products_id=p2c.products_id left join categories c on p2c.categories_id=c.categories_id left join categories_description cd on c.parent_id = \'0\' and c.categories_id = cd.categories_id left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join products_description pd on p.products_id = pd.products_id and pd.language_id = \'1\' left join specials s on p.products_id = s.products_id where products_status = \'1\' order by cd.categories_name, c.parent_id, c.sort_order, c.categories_id, pd.products_name ) as total

 

 

this is the whole print_catalog.php file

<?php
/*
 $Id: print_catalog.php,v 1.1 2002/12/12 Kim Elliott-BirdBrain$

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRINT_CATALOG);

 $breadcrumb->
add(NAVBAR_TITLE, tep_href_link(FILENAME_PRINT_CATALOG, '', 'NONSSL'));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>
>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>
 ">
 <title>
	 <?php echo TITLE; ?>
 </title>
 <base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>
 ">
 <link rel="stylesheet" type="text/css" href="catalogstylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
 <table class="products" width="775" align="center" border="0" cellspacing="1" cellpadding="1">
	 <tr>
   <!-- header -->
   <td >
  	 <?php require(DIR_WS_INCLUDES . 'print_header.php'); ?>
   </td>
   <!-- header-eof -->
	 </tr>
	 <?php
    $print_catalog_query_raw = "select count(*) as total, p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, cd.categories_name, m.manufacturers_name from products p left join products_to_categories p2c on p.products_id=p2c.products_id left join categories c on p2c.categories_id=c.categories_id left join categories_description cd on c.parent_id = '0' and c.categories_id = cd.categories_id left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join products_description pd on p.products_id = pd.products_id and pd.language_id = '1' left join specials s on p.products_id = s.products_id where products_status = '1' order by cd.categories_name, c.parent_id, c.sort_order, c.categories_id, pd.products_name ";
	 
    $print_catalog_split = new splitPageResults($HTTP_GET_VARS['page'],
	 MAX_DISPLAY_PRINT_CATALOG, $print_catalog_query_raw, $print_catalog_numrows);
	 
    $print_catalog_query = tep_db_query($print_catalog_query_raw);
    while ($print_catalog = tep_db_fetch_array($print_catalog_query)) {
      $print_catalog_array[] = array('id' =>
   $print_catalog['products_id'],
                                    'name' =>
   $print_catalog['products_name'],
                                    'description' =>
   $print_catalog['products_description'],
                                    'model' =>
   $print_catalog['products_model'],
                                    'image' =>
   $print_catalog['products_image'],
                                    'price' =>
   $print_catalog['products_price'],
                                    'specials_price' =>
   $print_catalog['specials_new_products_price'],
                                    'tax_class_id' =>
   $print_catalog['products_tax_class_id'],
                                    'date_added' =>
   tep_date_long($print_catalog['products_date_added']),
                                    'manufacturer' =>
   $print_catalog['manufacturers_name']);
    }
	 ?>
	 <tr>
   <!-- top page navigation -->
   <td >
  	 <table class="header" border="0" width="100%" cellspacing="2" cellpadding="2">
               
     <tr>
                   
    	 <td class="smallText">
       <?php echo $print_catalog_split->
       display_count($print_catalog_numrows, MAX_DISPLAY_PRINT_CATALOG, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>      
                  
    	 <td align="right" class="smallText">
       <?php echo TEXT_RESULT_PAGE; ?><?php echo $print_catalog_split->
       display_links($print_catalog_numrows, MAX_DISPLAY_PRINT_CATALOG, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?>
    	 </td>
                
     </tr>
             
  	 </table>
   </td>
   <!-- top page navigation-eof -->
	 </tr>
	 <tr>
   <!-- catalog -->
   <td >
  	 <?php
      require(DIR_WS_MODULES  . 'print_catalog.php');
  	 ?>
  	 
   </td>
   <!-- catalog-eof -->
   <?php
     if ($print_catalog_numrows >
    0 && (PREV_NEXT_BAR_LOCATION == '2' || PREV_NEXT_BAR_LOCATION == '3')) {
   ?>
   
	 </tr>
	 <tr>
   <!-- bottom page navigation -->
   <td >
  	 <table class="header" border="0" width="100%" cellspacing="2" cellpadding="2">
               
     <tr>
                  
    	 <td class="smallText">
       <?php echo $print_catalog_split->
       display_count($print_catalog_numrows, MAX_DISPLAY_PRINT_CATALOG, $HTTP_GET_VARS['page'],TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?>
    	 </td>
                  
    	 <td align="right" class="smallText">
       <?php echo TEXT_RESULT_PAGE; ?>
        
       <?php echo $print_catalog_split->
       display_links($print_catalog_numrows, MAX_DISPLAY_PRINT_CATALOG, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?>
    	 </td>
                
     </tr>
             
  	 </table>
   </td>
   <!-- bottom page navigation-eof -->
   <?php
     }
   ?>
   
	 </tr>
	 <tr>
   <!-- footer -->
   <td >
  	 <?php require(DIR_WS_INCLUDES . 'print_footer.php'); ?>
  	 
   </td>
   <!-- footer-eof -->
	 </tr>
 </table>
 
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

which product description contribution are you using? i got the similar error when using the latest one in the contribution area,

Link to comment
Share on other sites

  • 3 months later...
  • 7 months later...

Just uploaded a new version (although I never noticed the heavily modded V3.x that is also about - maybe I have just wasted my very sought after important & precious time?!)

 

My new version is here http://www.oscommerce.com/community/contributions,815

Thanks for any help/comments.

 

Regards,

 

Lewis Hill

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...