denise craft cabin Posted April 21, 2006 Posted April 21, 2006 This warning comes every time i click from the catergories to the products, in the front of my shop... after i added an events calendar... I cant see the error...can anyone please help?? I have posted the code, and mt site, if anyone can please help, i would appreciate it... cheers Warning: Missing argument 4 for splitpageresults() in D:\hosting\vhosts\the-craft-cabin.co.uk\httpdocs\shop\includes\classes\split_page_results.php on line 24 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 'p.products_id' at line 1 select count(*) as total p.products_id <?php /* $Id: split_page_results.php,v 1.10 2002/11/23 16:33:58 dgw_ Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2002 osCommerce Released under the GNU General Public License */ class splitPageResults { /* NOTE: the constructor (also) builds an sql query that counts the total records from $sql_query.. this value is then saved as $query_num_rows (which does not have to be set before creating an instance of this class. Please note the function references (&$variable) - please read up on this in the PHP documentation. */ /* class constructor */ function splitPageResults(&$current_page_number, $max_rows_per_page, &$sql_query, &$query_num_rows) { if (empty($current_page_number)) $current_page_number = 1; $pos_to = strlen($sql_query); $pos_from = strpos($sql_query, ' from', 0); $pos_group_by = strpos($sql_query, ' group by', $pos_from); if (($pos_group_by < $pos_to) && ($pos_group_by != false)) $pos_to = $pos_group_by; $pos_having = strpos($sql_query, ' having', $pos_from); if (($pos_having < $pos_to) && ($pos_having != false)) $pos_to = $pos_having; $pos_order_by = strpos($sql_query, ' order by', $pos_from); if (($pos_order_by < $pos_to) && ($pos_order_by != false)) $pos_to = $pos_order_by; $pos_limit = strpos($sql_query, ' limit', $pos_from); if (($pos_limit < $pos_to) && ($pos_limit != false)) $pos_to = $pos_limit; $pos_procedure = strpos($sql_query, ' procedure', $pos_from); if (($pos_procedure < $pos_to) && ($pos_procedure != false)) $pos_to = $pos_procedure; $offset = ($max_rows_per_page * ($current_page_number - 1)); $sql_query .= " limit " . $offset . ", " . $max_rows_per_page; $reviews_count_query = tep_db_query("select count(*) as total " . substr($sql_query, $pos_from, ($pos_to - $pos_from))); $reviews_count = tep_db_fetch_array($reviews_count_query); $query_num_rows = $reviews_count['total']; } /* class functions */ // display split-page-number-links function display_links($query_numrows, $max_rows_per_page, $max_page_links, $current_page_number, $parameters = '') { global $PHP_SELF; $class = 'class="pageResults"'; if ( tep_not_null($parameters) && (substr($parameters, -1) != '&') ) $parameters .= '&'; // calculate number of pages needing links $num_pages = intval($query_numrows / $max_rows_per_page); // $num_pages now contains int of pages needed unless there is a remainder from division if ($query_numrows % $max_rows_per_page) $num_pages++; // has remainder so add one page // first button - not displayed on first page // if ($current_page_number > 1) echo '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=1', 'NONSSL') . '" ' . $class . ' title=" ' . PREVNEXT_TITLE_FIRST_PAGE . ' ">' . PREVNEXT_BUTTON_FIRST . '</a> '; // previous button - not displayed on first page if ($current_page_number > 1) echo '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . ($current_page_number - 1), 'NONSSL') . '" ' . $class . ' title=" ' . PREVNEXT_TITLE_PREVIOUS_PAGE . ' "><u>' . PREVNEXT_BUTTON_PREV . '</u></a> '; // check if num_pages > $max_page_links $cur_window_num = intval($current_page_number / $max_page_links); if ($current_page_number % $max_page_links) $cur_window_num++; $max_window_num = intval($num_pages / $max_page_links); if ($num_pages % $max_page_links) $max_window_num++; // previous window of pages if ($cur_window_num > 1) echo '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . (($cur_window_num - 1) * $max_page_links), 'NONSSL') . '" ' . $class . ' 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 <= $num_pages); $jump_to_page++) { if ($jump_to_page == $current_page_number) { echo ' <b>' . $jump_to_page . '</b> '; } else { echo ' <a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . $jump_to_page, 'NONSSL') . '" ' . $class . ' 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) echo '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . (($cur_window_num) * $max_page_links + 1), 'NONSSL') . '" ' . $class . ' title=" ' . sprintf(PREVNEXT_TITLE_NEXT_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a> '; // next button if (($current_page_number < $num_pages) && ($num_pages != 1)) echo ' <a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . ($current_page_number + 1), 'NONSSL') . '" ' . $class . ' title=" ' . PREVNEXT_TITLE_NEXT_PAGE . ' "><u>' . PREVNEXT_BUTTON_NEXT . '</u></a> '; // last button // if (($current_page_number < $num_pages) && ($num_pages != 1)) echo '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . $num_pages, 'NONSSL') . '" ' . $class . ' title=" ' . PREVNEXT_TITLE_LAST_PAGE . ' ">' . PREVNEXT_BUTTON_LAST . '</a> '; } // display number of total products found function display_count($query_numrows, $max_rows_per_page, $current_page_number, $text_output) { $to_num = ($max_rows_per_page * $current_page_number); if ($to_num > $query_numrows) $to_num = $query_numrows; $from_num = ($max_rows_per_page * ($current_page_number - 1)); if ($to_num == 0) { $from_num = 0; } else { $from_num++; } return sprintf($text_output, $from_num, $to_num, $query_numrows); } } ?>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.