Guest Posted April 23, 2004 Share Posted April 23, 2004 Hi I just installed the printed catalogue contribution and recieve this when I click the printed Catalogue link. Anyone any ideas? :huh: 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_descript 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 [TEP STOP] Quote Link to comment Share on other sites More sharing options...
Guest Posted April 23, 2004 Share Posted April 23, 2004 as a footnote The server is running MySQL 4.0.18-standard Quote Link to comment Share on other sites More sharing options...
ozEworks Posted May 27, 2004 Share Posted May 27, 2004 I got this too. Any helpers? Has the database changed since this contribution was made or is it really an SQL error? Quote Link to comment Share on other sites More sharing options...
ozEworks Posted June 3, 2004 Share Posted June 3, 2004 can anyone help on this one? Quote Link to comment Share on other sites More sharing options...
mark27uk3 Posted June 4, 2004 Share Posted June 4, 2004 me got this problem 2! Please Help! Mark Quote Lifes a bitch, then you marry one, then you die! Link to comment Share on other sites More sharing options...
ozEworks Posted June 9, 2004 Share Posted June 9, 2004 sorry to keep asking but can't someone who has this contribution look at their code and post it so we can at least compare to this???? Quote Link to comment Share on other sites More sharing options...
ozEworks Posted June 23, 2004 Share Posted June 23, 2004 Can anyone please help on this one? Quote Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted June 23, 2004 Share Posted June 23, 2004 the error appears to be generated in this function. It's in includes/classes/split_page_results. Either, this piece of code is different on your system, or the print catalog is populating the $count_key with $query (when passing the parameters to this function). HTH Carine This is the MS2 version function splitPageResults($query, $max_rows, $count_key = '*', $page_holder = 'page') { global $HTTP_GET_VARS, $HTTP_POST_VARS; $this->sql_query = $query; $this->page_name = $page_holder; if (isset($HTTP_GET_VARS[$page_holder])) { $page = $HTTP_GET_VARS[$page_holder]; } elseif (isset($HTTP_POST_VARS[$page_holder])) { $page = $HTTP_POST_VARS[$page_holder]; } else { $page = ''; } if (empty($page) || !is_numeric($page)) $page = 1; $this->current_page_number = $page; $this->number_of_rows_per_page = $max_rows; $pos_to = strlen($this->sql_query); $pos_from = strpos($this->sql_query, ' from', 0); $pos_group_by = strpos($this->sql_query, ' group by', $pos_from); if (($pos_group_by < $pos_to) && ($pos_group_by != false)) $pos_to = $pos_group_by; $pos_having = strpos($this->sql_query, ' having', $pos_from); if (($pos_having < $pos_to) && ($pos_having != false)) $pos_to = $pos_having; $pos_order_by = strpos($this->sql_query, ' order by', $pos_from); if (($pos_order_by < $pos_to) && ($pos_order_by != false)) $pos_to = $pos_order_by; if (strpos($this->sql_query, 'distinct') || strpos($this->sql_query, 'group by')) { $count_string = 'distinct ' . tep_db_input($count_key); } else { $count_string = tep_db_input($count_key); } $count_query = tep_db_query("select count(" . $count_string . ") as total " . substr($this->sql_query, $pos_from, ($pos_to - $pos_from))); $count = tep_db_fetch_array($count_query); $this->number_of_rows = $count['total']; $this->number_of_pages = ceil($this->number_of_rows / $this->number_of_rows_per_page); if ($this->current_page_number > $this->number_of_pages) { $this->current_page_number = $this->number_of_pages; } $offset = ($this->number_of_rows_per_page * ($this->current_page_number - 1)); $this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page; } Quote 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 More sharing options...
mark27uk3 Posted June 24, 2004 Share Posted June 24, 2004 Hi, Unfortunately that did not solve the problem. Still getting this as the 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 p.products_id, pd.products_name, pd.products_descript 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 [TEP STOP] Someone out there must have solved this problem!???? Regards Mark Quote Lifes a bitch, then you marry one, then you die! Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted June 24, 2004 Share Posted June 24, 2004 please post the code that calls splitPageResults Quote 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 More sharing options...
mark27uk3 Posted June 24, 2004 Share Posted June 24, 2004 Hi bruyndoncx, Here is the code for split_page_results.php <?php /* $Id: split_page_results.php,v 1.15 2003/06/09 22:35:34 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class splitPageResults { var $sql_query, $number_of_rows, $current_page_number, $number_of_pages, $number_of_rows_per_page, $page_name; /* class constructor */ function splitPageResults($query, $max_rows, $count_key = '*', $page_holder = 'page') { global $HTTP_GET_VARS, $HTTP_POST_VARS; $this->sql_query = $query; $this->page_name = $page_holder; if (isset($HTTP_GET_VARS[$page_holder])) { $page = $HTTP_GET_VARS[$page_holder]; } elseif (isset($HTTP_POST_VARS[$page_holder])) { $page = $HTTP_POST_VARS[$page_holder]; } else { $page = ''; } if (empty($page) || !is_numeric($page)) $page = 1; $this->current_page_number = $page; $this->number_of_rows_per_page = $max_rows; $pos_to = strlen($this->sql_query); $pos_from = strpos($this->sql_query, ' from', 0); $pos_group_by = strpos($this->sql_query, ' group by', $pos_from); if (($pos_group_by < $pos_to) && ($pos_group_by != false)) $pos_to = $pos_group_by; $pos_having = strpos($this->sql_query, ' having', $pos_from); if (($pos_having < $pos_to) && ($pos_having != false)) $pos_to = $pos_having; $pos_order_by = strpos($this->sql_query, ' order by', $pos_from); if (($pos_order_by < $pos_to) && ($pos_order_by != false)) $pos_to = $pos_order_by; if (strpos($this->sql_query, 'distinct') || strpos($this->sql_query, 'group by')) { $count_string = 'distinct ' . tep_db_input($count_key); } else { $count_string = tep_db_input($count_key); } $count_query = tep_db_query("select count(" . $count_string . ") as total " . substr($this->sql_query, $pos_from, ($pos_to - $pos_from))); $count = tep_db_fetch_array($count_query); $this->number_of_rows = $count['total']; $this->number_of_pages = ceil($this->number_of_rows / $this->number_of_rows_per_page); if ($this->current_page_number > $this->number_of_pages) { $this->current_page_number = $this->number_of_pages; } $offset = ($this->number_of_rows_per_page * ($this->current_page_number - 1)); $this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page; } /* class functions */ // display split-page-number-links function display_links($max_page_links, $parameters = '') { global $PHP_SELF, $request_type; $display_links_string = ''; $class = 'class="pageResults"'; if (tep_not_null($parameters) && (substr($parameters, -1) != '&')) $parameters .= '&'; // previous button - not displayed on first page if ($this->current_page_number > 1) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . ($this->current_page_number - 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_PREVIOUS_PAGE . ' "><u>' . PREVNEXT_BUTTON_PREV . '</u></a> '; // check if number_of_pages > $max_page_links $cur_window_num = intval($this->current_page_number / $max_page_links); if ($this->current_page_number % $max_page_links) $cur_window_num++; $max_window_num = intval($this->number_of_pages / $max_page_links); if ($this->number_of_pages % $max_page_links) $max_window_num++; // previous window of pages if ($cur_window_num > 1) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . (($cur_window_num - 1) * $max_page_links), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PREV_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a>'; // page nn button for ($jump_to_page = 1 + (($cur_window_num - 1) * $max_page_links); ($jump_to_page <= ($cur_window_num * $max_page_links)) && ($jump_to_page <= $this->number_of_pages); $jump_to_page++) { if ($jump_to_page == $this->current_page_number) { $display_links_string .= ' <b>' . $jump_to_page . '</b> '; } else { $display_links_string .= ' <a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . $jump_to_page, $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PAGE_NO, $jump_to_page) . ' "><u>' . $jump_to_page . '</u></a> '; } } // next window of pages if ($cur_window_num < $max_window_num) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . (($cur_window_num) * $max_page_links + 1), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_NEXT_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a> '; // next button if (($this->current_page_number < $this->number_of_pages) && ($this->number_of_pages != 1)) $display_links_string .= ' <a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . ($this->current_page_number + 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_NEXT_PAGE . ' "><u>' . PREVNEXT_BUTTON_NEXT . '</u></a> '; return $display_links_string; } // display number of total products found function display_count($text_output) { $to_num = ($this->number_of_rows_per_page * $this->current_page_number); if ($to_num > $this->number_of_rows) $to_num = $this->number_of_rows; $from_num = ($this->number_of_rows_per_page * ($this->current_page_number - 1)); if ($to_num == 0) { $from_num = 0; } else { $from_num++; } return sprintf($text_output, $from_num, $to_num, $this->number_of_rows); } } ?> Thanks Mark Quote Lifes a bitch, then you marry one, then you die! Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted June 24, 2004 Share Posted June 24, 2004 Mark, I meant the printed catalogue code is that calling splitPageResults, as it appears that it is called and passing parameters the wrong way. Carine Quote 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 More sharing options...
mark27uk3 Posted June 24, 2004 Share Posted June 24, 2004 Sorry, I hope this is right! <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html dir="LTR" lang="en" > <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 "> <title> osCommerce </title> <base href="http://24-7mobileaccessories.co.uk/ "> <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 > <table class="header" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <!-- store info & logo --> <td > <table class="headerContents" width="100%" border="0" cellspacing="2" cellpadding="2"> <tr> <!-- store info --> <td align="left"> Store Name<br /> Address<br /> Country<br /> Phone </td> <!-- store info-eof --> <!-- logo--> <td align="right"> <img src="images/TubeLogo.gif" border="0" alt="Bird-E-Toys" title=" Bird-E-Toys "> </td> <!-- logo-eof--> </tr> </table> </td> <!-- store info & logo-eof --> </tr> <tr> <!-- information --> <td > <table class="headerContents" width="100%" border="0" cellspacing="2" cellpadding="2"> <tr> <td> All prices and stock are current as of: Thursday 24 June, 2004 </td> </tr> </table> </td> <!-- information-eof --> </tr> </table> </td> <!-- header-eof --> </tr> <font color="#000000"><b>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_descript<br><br>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 <br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font> Mark Quote Lifes a bitch, then you marry one, then you die! Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted June 24, 2004 Share Posted June 24, 2004 are you using this contribution ? http://www.oscommerce.com/community/contributions,234 The file in the pack seems absolutely fine; perhaps better to re-install that one Quote 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 More sharing options...
ozEworks Posted September 9, 2004 Share Posted September 9, 2004 I have not bothered with this for a long time but I reloaded the contribution the last post spoke of which is in fact a kind of new version than what I had before and now it works in a very basic way as in the products are listed in alpha order of product name rather than following the hierarchy of category/subcategory/product. I can live with it but is there anything better out there? (I am going to look myself as well) Quote Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted September 9, 2004 Share Posted September 9, 2004 or you can try "our" printable pricelist :D Quote 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 More sharing options...
ozEworks Posted September 17, 2004 Share Posted September 17, 2004 Thanks I'll take a look at it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.