Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

mysql syntax error


Guest

Recommended Posts

Hello,

 

I'm a total newbie to OSC and don't have a very good understanding of mysql. We purchased a template today and installed a new store at http://NohassleJewelry.com. Most everything is good so far but on the specials page (link at the top of the page just right of center) I'm receiving an error message.

 

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 '-9, 9' at line 1

select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC limit -9, 9

[TEP STOP]

 

I have no idea how to fix this to make it go away.

 

Store Details:

version: 2.2 MS2 (060817

mysql: 4.1.21-standard

PHP: 5.1.6

apache: 1.3.37 (Unix)

 

Thanks

Link to comment
Share on other sites

Hello,

 

I'm a total newbie to OSC and don't have a very good understanding of mysql. We purchased a template today and installed a new store at http://NohassleJewelry.com. Most everything is good so far but on the specials page (link at the top of the page just right of center) I'm receiving an error message.

 

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 '-9, 9' at line 1

select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC limit -9, 9

[TEP STOP]

 

I have no idea how to fix this to make it go away.

 

Store Details:

version: 2.2 MS2 (060817

mysql: 4.1.21-standard

PHP: 5.1.6

apache: 1.3.37 (Unix)

 

Thanks

 

 

I have found a link that may be of some interest for you.

 

MySQL Error 1064

 

Hope this helps you out.

Do or Do Not, there is no try.

Link to comment
Share on other sites

Thanks for the article... after reading it couple of times.. it still doesn't make a whole lot of sense to me. In PHP my Admin I see SQL compatibilty mode but have no idea which option to select.

 

Furthermore.. I noticed in the collation column each table is using latin1_swedish_ci and the article says

 

"Here i could replace latin1 with utf8,

because my target version of mysql was different from the from which i

took backup."

 

But i have no idea how change from latin1 to utf8.

 

And this may all be jiberish.. like i said i have no knowledge of mysql.

Link to comment
Share on other sites

Thanks for the article... after reading it couple of times.. it still doesn't make a whole lot of sense to me. In PHP my Admin I see SQL compatibilty mode but have no idea which option to select.

 

Furthermore.. I noticed in the collation column each table is using latin1_swedish_ci and the article says

 

"Here i could replace latin1 with utf8,

because my target version of mysql was different from the from which i

took backup."

 

But i have no idea how change from latin1 to utf8.

 

And this may all be jiberish.. like i said i have no knowledge of mysql.

 

Do you have something that looks similar to this in PHPMyAdmin? See below:

 

* MySQL charset: UTF-8 Unicode (utf8)

* MySQL connection collation: utf8_unicode_ci (note: change latin1_swedish_ci to utf8_unicode_ci)

 

Also, are you able to click on the products table in PHPMyAdmin and see which rows have a collation? I show product_model and product_image only.

Do or Do Not, there is no try.

Link to comment
Share on other sites

Thanks for the article... after reading it couple of times.. it still doesn't make a whole lot of sense to me. In PHP my Admin I see SQL compatibilty mode but have no idea which option to select.

 

Furthermore.. I noticed in the collation column each table is using latin1_swedish_ci and the article says

 

"Here i could replace latin1 with utf8,

because my target version of mysql was different from the from which i

took backup."

 

But i have no idea how change from latin1 to utf8.

 

And this may all be jiberish.. like i said i have no knowledge of mysql.

 

 

Are you able to look at the specials.php file? This is what the code should be without alterations. See below:

 

<?php

$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

 

COMPARED TO YOURS

 

select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC limit -9, 9

 

Take the original code and inserted it back into the application. It looks like there are some referencing of tables missing.

Do or Do Not, there is no try.

Link to comment
Share on other sites

i have a collation column and every table is set to latin1_swedish_ci... see screenshot

 

nohaweb_mysql.gif

 

thanks for your help this evening i really appreciate it. :)

 

I was able to recreate the error message on my side. Take this code below:

 

<?php

$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC";

 

and replace yours. Take out the limit -9, 9 info.

Do or Do Not, there is no try.

Link to comment
Share on other sites

in my specials.php page, the code that came with my install is as follows...

 

<?php
 $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";
 $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>

 

There is no "limit -9, 9"

 

This is why i'm lost... I have no idea where the limit -9, 9 info is coming from.

 

any thoughts

Link to comment
Share on other sites

in my specials.php page, the code that came with my install is as follows...

 

<?php
 $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";
 $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>

 

There is no "limit -9, 9"

 

This is why i'm lost... I have no idea where the limit -9, 9 info is coming from.

 

any thoughts

 

can you provide the whole code for the specials.php?

Do or Do Not, there is no try.

Link to comment
Share on other sites

This is the original code from my install. I did try and replace the snippet of code that you sent over in a previous post and still received the same error.

 

thanks again for troubleshooting this with me.

 

<?php
/*
 $Id: specials.php,v 1.49 2003/06/09 22:35:33 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

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

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SPECIALS));
?>
<!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 (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
<!-- body_text //-->
<td width="100%" valign="top">

 <table cellspacing=0 cellpadding=0 width=485>
  <tr><td colspan=7 class="pageHeading"><?php echo HEADING_TITLE; ?></td></tr>
  <tr><td height=3></td></tr>
 </table>
 <table cellspacing=0 cellpadding=0 width=479>
  <tr><td class=ch7>
   <table celLspacing=0 cellpadding=0 width=479>
	<tr>




<?php
 $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";
 $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>

  <tr>
	<td><table border="0" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>
		<td width=150></td>
		<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
	  </tr>
	</table></td>
  </tr>
<?php
 }
?>
  <tr>
	<td><table cellspacing="0" cellpadding="0" width=100%>
	  <tr>
<?php
$row = 0;
$specials_query = tep_db_query($specials_split->sql_query);
while ($specials = tep_db_fetch_array($specials_query)) {
  $row++;
  $product_query = tep_db_query("select products_description  from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$specials['products_id'] . "' and language_id = '" . (int)1 . "'");
  $product = tep_db_fetch_array($product_query);
  $new_products['products_description'] = $product['products_description'];

  echo '

	<td width=237 valign=top align=center>
	 <table cellspacing=0 cellpadding=0 width=233>
	  <tr><td height=0></td></tr>
	  <tr><td colspan=3 height=35 style="padding-left:8px"  valign=middle class=ch8><a class=ch8_  href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . $specials['products_name'] . '</a></td></tr>
	  <tr><td height=1></td></tr>
	  <tr><td colspan=3 bgcolor=#B0C0D0 width=230 height=1></td></tr>
	  <tr><td height=13></td></tr>
	  <tr><td width=100 valign=top align=center><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $specials['products_image'], $specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>
	  <td width=10></td>
	  <td valign=top>
	   <table cellspacing=0 cellpadding=0 width=113 align=right>
		<tr><td class=ml3>item# '.$listing['products_id'].'</td></tr>
		<tr><td height=2></td></tr>
		<tr><td height=45 valign=middle><span class=ch9>only:</span> <s class=ch10 class=ch10  style="color:#7F7F7F;font-size:11px"><b>'.$currencies->display_price($specials['products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '<b></s><br>            <span class=ch10 style="font-size:13px; font-weight:bold">' . $currencies->display_price($specials['specials_new_products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</span></td></tr>
		<tr><td height=2></td></tr>
		<tr><td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . tep_image_button('small_view.gif') . '</a></td></tr>
		<tr><td height=2></td></tr>
		<tr><td><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $specials['products_id']) . '">' . tep_image_button('button_in_cart.gif') . '</a></td></tr>
	   </table>
	  </td></tr>
	  <tr><td height=4></td></tr>
	 </table>
  </td>

	   ' . "\n";

  if ((($row / 2) == floor($row / 2))) {
?>

  </tr>
  <tr><td colspan=3 bgcolor=#E7EBF0 width=479 height=3></td></tr>
   <tr>





<?php  //middle coln space
  }else echo '<td bgcolor=#E7EBF0 height=100% width=3></td>';
}
?>

  </tr>
 </table>
 </td></tr>
</table>




   </td>
  </tr>
<?php
 if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
  <tr>
	<td><br><table border="0" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>
		<td width=150></td>
		<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
	  </tr>
	</table></td>
  </tr>
<?php
 }
?>

  </tr>
 </table>

</td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

This is the original code from my install. I did try and replace the snippet of code that you sent over in a previous post and still received the same error.

 

thanks again for troubleshooting this with me.

 

<?php
/*
 $Id: specials.php,v 1.49 2003/06/09 22:35:33 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

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

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SPECIALS));
?>
<!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 (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
<!-- body_text //-->
<td width="100%" valign="top">

 <table cellspacing=0 cellpadding=0 width=485>
  <tr><td colspan=7 class="pageHeading"><?php echo HEADING_TITLE; ?></td></tr>
  <tr><td height=3></td></tr>
 </table>
 <table cellspacing=0 cellpadding=0 width=479>
  <tr><td class=ch7>
   <table celLspacing=0 cellpadding=0 width=479>
	<tr>
<?php
 $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";
 $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>

  <tr>
	<td><table border="0" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>
		<td width=150></td>
		<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
	  </tr>
	</table></td>
  </tr>
<?php
 }
?>
  <tr>
	<td><table cellspacing="0" cellpadding="0" width=100%>
	  <tr>
<?php
$row = 0;
$specials_query = tep_db_query($specials_split->sql_query);
while ($specials = tep_db_fetch_array($specials_query)) {
  $row++;
  $product_query = tep_db_query("select products_description  from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$specials['products_id'] . "' and language_id = '" . (int)1 . "'");
  $product = tep_db_fetch_array($product_query);
  $new_products['products_description'] = $product['products_description'];

  echo '

	<td width=237 valign=top align=center>
	 <table cellspacing=0 cellpadding=0 width=233>
	  <tr><td height=0></td></tr>
	  <tr><td colspan=3 height=35 style="padding-left:8px"  valign=middle class=ch8><a class=ch8_  href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . $specials['products_name'] . '</a></td></tr>
	  <tr><td height=1></td></tr>
	  <tr><td colspan=3 bgcolor=#B0C0D0 width=230 height=1></td></tr>
	  <tr><td height=13></td></tr>
	  <tr><td width=100 valign=top align=center><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $specials['products_image'], $specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>
	  <td width=10></td>
	  <td valign=top>
	   <table cellspacing=0 cellpadding=0 width=113 align=right>
		<tr><td class=ml3>item# '.$listing['products_id'].'</td></tr>
		<tr><td height=2></td></tr>
		<tr><td height=45 valign=middle><span class=ch9>only:</span> <s class=ch10 class=ch10  style="color:#7F7F7F;font-size:11px"><b>'.$currencies->display_price($specials['products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '<b></s><br>            <span class=ch10 style="font-size:13px; font-weight:bold">' . $currencies->display_price($specials['specials_new_products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</span></td></tr>
		<tr><td height=2></td></tr>
		<tr><td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . tep_image_button('small_view.gif') . '</a></td></tr>
		<tr><td height=2></td></tr>
		<tr><td><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $specials['products_id']) . '">' . tep_image_button('button_in_cart.gif') . '</a></td></tr>
	   </table>
	  </td></tr>
	  <tr><td height=4></td></tr>
	 </table>
  </td>

	   ' . "\n";

  if ((($row / 2) == floor($row / 2))) {
?>

  </tr>
  <tr><td colspan=3 bgcolor=#E7EBF0 width=479 height=3></td></tr>
   <tr>



<?php  //middle coln space
  }else echo '<td bgcolor=#E7EBF0 height=100% width=3></td>';
}
?>

  </tr>
 </table>
 </td></tr>
</table>

   </td>
  </tr>
<?php
 if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
  <tr>
	<td><br><table border="0" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>
		<td width=150></td>
		<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
	  </tr>
	</table></td>
  </tr>
<?php
 }
?>

  </tr>
 </table>

</td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

ok, take this code and replace all the specials.php code from top to bottom. I would suggest making a copy of your specials.php and make a new specials.php file.

 

<?php

/*

$Id: specials.php,v 1.49 2003/06/09 22:35:33 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

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

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SPECIALS));

?>

<!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 (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="0" cellpadding="0">

 

<!-- body_text //-->

<td width="100%" valign="top">

 

<table cellspacing="0" cellpadding="0" width="485">

<tr><td colspan=7 class="pageHeading"><?php echo HEADING_TITLE; ?></td></tr>

<tr><td height=3></td></tr>

</table>

<table cellspacing=0 cellpadding=0 width=479>

<tr><td class=ch7>

<table celLspacing=0 cellpadding=0 width=479>

<tr>

 

 

 

 

<?php

$specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

$specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 

if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

 

<tr>

<td><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>

<td width=150></td>

<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

</tr>

</table></td>

</tr>

<?php

}

?>

<tr>

<td><table cellspacing="0" cellpadding="0" width=100%>

<tr>

<?php

$row = 0;

$specials_query = tep_db_query($specials_split->sql_query);

while ($specials = tep_db_fetch_array($specials_query)) {

$row++;

$product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$specials['products_id'] . "' and language_id = '" . (int)1 . "'");

$product = tep_db_fetch_array($product_query);

$new_products['products_description'] = $product['products_description'];

 

?>

 

<td width="237" valign="top" align="center">

<table cellspacing=0 cellpadding=0 width=233>

<tr><td height=0></td></tr>

<tr><td colspan=3 height=35 style="padding-left:8px" valign=middle class=ch8><a class=ch8_ href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . $specials['products_name'] . '</a></td></tr>

<tr><td height=1></td></tr>

<tr><td colspan=3 bgcolor=#B0C0D0 width=230 height=1></td></tr>

<tr><td height=13></td></tr>

<tr><td width=100 valign=top align=center><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $specials['products_image'], $specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>

<td width=10></td>

<td valign=top>

<table cellspacing=0 cellpadding=0 width=113 align=right>

<tr><td class=ml3>item# '.$listing['products_id'].'</td></tr>

<tr><td height=2></td></tr>

<tr><td height=45 valign=middle><span class=ch9>only:</span> <s class=ch10 class=ch10 style="color:#7F7F7F;font-size:11px"><b>'.$currencies->display_price($specials['products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '<b></s><br>            <span class=ch10 style="font-size:13px; font-weight:bold">' . $currencies->display_price($specials['specials_new_products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</span></td></tr>

<tr><td height=2></td></tr>

<tr><td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . tep_image_button('small_view.gif') . '</a></td></tr>

<tr><td height=2></td></tr>

<tr><td><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $specials['products_id']) . '">' . tep_image_button('button_in_cart.gif') . '</a></td></tr>

</table>

</td></tr>

<tr><td height=4></td></tr>

</table>

</td>

 

' . "\n";

 

if ((($row / 2) == floor($row / 2))) {

?>

 

</tr>

<tr><td colspan=3 bgcolor=#E7EBF0 width=479 height=3></td></tr>

<tr>

 

 

 

 

 

<?php //middle coln space

//}else echo '<td bgcolor=#E7EBF0 height=100% width=3></td>';

}

?>

 

</tr>

</table>

</td></tr>

</table>

 

 

 

 

</td>

</tr>

<?php

if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {

?>

<tr>

<td><br><table border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>

<td width=150></td>

<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

</tr>

</table></td>

</tr>

<?php

}

?>

 

</tr>

</table>

 

</td>

<!-- body_text_eof //-->

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Do or Do Not, there is no try.

Link to comment
Share on other sites

So at this point... the code replacement didn't fix the problem. however I haven't changed anything in the database. Should I change the collation of the tables from latin1_swedish to utf8_unicode?

 

If so for which tables... some or all?

 

Thanks

Link to comment
Share on other sites

So at this point... the code replacement didn't fix the problem. however I haven't changed anything in the database. Should I change the collation of the tables from latin1_swedish to utf8_unicode?

 

If so for which tables... some or all?

 

Thanks

 

 

I don't think it is the DB, just because everything else is working correctly. I really think it has to do with the specials.php.

 

Would you mind sending the header and footer. I will piece it together. Thank s.

Do or Do Not, there is no try.

Link to comment
Share on other sites

Header Code:

 

<?php
/*
 $Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
// START STS 4.1
$sts->restart_capture ('applicationtop2header');
// END STS 4.1

// check if the 'install' directory exists, and warn of its existence
 if (WARN_INSTALL_EXISTENCE == 'true') {
if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/install')) {
  $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning');
}
 }

// check if the configure.php file is writeable
 if (WARN_CONFIG_WRITEABLE == 'true') {
if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) ) {
  $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning');
}
 }

// check if the session folder is writeable
 if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {
if (STORE_SESSIONS == '') {
  if (!is_dir(tep_session_save_path())) {
	$messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');
  } elseif (!is_writeable(tep_session_save_path())) {
	$messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');
  }
}
 }

// check session.auto_start is disabled
 if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {
if (ini_get('session.auto_start') == '1') {
  $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');
}
 }

 if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {
if (!is_dir(DIR_FS_DOWNLOAD)) {
  $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');
}
 }

 if ($messageStack->size('header') > 0) {
echo $messageStack->output('header');
 }
?>
<!--




<?   // ---- MANUFACTURERS


 $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
 if ($number_of_rows = tep_db_num_rows($manufacturers_query)) {

  echo '<table cellspacing=0 cellpadding=0 width=177 align=center> '.
		  tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get')
		 .' <tr><td colspan=2><b>Search by manufacturers:</b></td></tr>
			<tr><td height=2 colspan=2></td></tr>
			<tr><td colspan=2>
	   ';	  

  $manufacturers_array = array();
  while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
	$manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
	$manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
								   'text' => $manufacturers_name);
  }

  echo tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" class=se1') . tep_hide_session_id();
  echo ' </td>
	  </form>
	 </table>
	   ';
 }

?>


-->

 <table bgcolor=#FFFFFF  cellspacing=0 cellpadding=0 width=660 height=100% align=center>
 <tr><td width=660 valign=top align=center>
  <table cellspacing=0 cellpadding=0 width=650 align=center>
<tr><td colspan=3 bgcolor=#F2F2F2 width=650 height=11 valign=top></td></tr>
<tr><td height=2></td></tr>
<tr><td colspan=3 bgcolor=#E2E2E2 width=650 height=6></td></tr>
<tr><td height=6></td></tr>
<tr><td colspan=3 width=650 height=89>
 <table cellspacing=0 cellpadding=0>
  <tr><td><a href=<?=tep_href_link('index.php')?>><img src=images/m02.gif width=246 height=89 border=0></a></td>
  <td width=135 valign=middle>

  </td>
  <td width=1></td>
  <td background=images/m04.gif width=1 height=89></td>
  <td width=121 valign=middle>
   <table cellspacing=0 cellpadding=0>

	<tr><td class=ch3 valign=top><img src=images/m05.gif width=4 height=4 align=absmiddle>  <a href=<?=tep_href_link('advanced_search.php')?> class=ch2>Search</a></td></tr>
	<tr><td class=ch3 valign=top><img src=images/m05.gif width=4 height=4 align=absmiddle>  <a href=<?=tep_href_link('contact_us.php')?> class=ch2>Contact Us</a></td></tr>
	<tr><td class=ch3 valign=top><img src=images/m05.gif width=4 height=4 align=absmiddle>  <a href=<?=tep_href_link('create_account.php')?> class=ch2>Create an account</a></td></tr>
	<tr><td class=ch3 valign=top><img src=images/m05.gif width=4 height=4 align=absmiddle>  <a href=<?=tep_href_link('login.php')?> class=ch2>Customer Login</a></td></tr>
   </table>
  </td>
  <td background=images/m04.gif width=1 height=89></td>
  <td>
   <table cellcpacing=0 cellpadding=0 class=ch3>
	<tr><td>
	 <table cellspacing=0 cellpadding=0>
	  <tr><td><a href=<?=tep_href_link('shopping_cart.php')?>><img src=images/m06.gif width=32 height=31 border=0></a></td>
	  <td width=11></td>
	  <td class=ch4><b>Shopping <br> Cart </b></td></tr>
	 </table>
	</td></tr>
	<tr><td height=6></td></tr>
	<tr><td class=ch4>now in your cart <a class=ml1  href=<?=tep_href_link('shopping_cart.php')?>><?=$cart->count_contents()?> items</a></td></tr>
   </table>
  </td>
  </tr>
 </table>
</td></tr>
<tr><td height=9></td></tr>
<tr><td colspan=3 bgcolor=#B0C0D0 width=650 height=5></td></tr>
<tr><td height=3></td></tr>
<tr><td bgcolor=#E7EBF0 valign=top width=160 align=center>
 <table cellspacing=0 cellpadding=0 width=152 align=center>
  <tr><td height=4></td></tr>
  <tr><td><a href=<?=tep_href_link('index.php')?>><img src=images/b01.gif width=152 heigth=25 border=0></a></td></tr>
  <tr><td height=4></td></tr>
  <tr><td><a href=<?=tep_href_link('products_new.php')?>><img src=images/b02.gif width=152 heigth=25 border=0></a></td></tr>
  <tr><td height=4></td></tr>
  <tr><td><a href=<?=tep_href_link('account.php')?>><img src=images/b03.gif width=152 heigth=25 border=0></a></td></tr>
  <tr><td height=4></td></tr>
  <tr><td><a href=<?=tep_href_link('shopping_cart.php')?>><img src=images/b04.gif width=152 heigth=25 border=0></a></td></tr>
  <tr><td height=4></td></tr>
  <tr><td><a href=<?=tep_href_link('checkout_shipping.php')?>><img src=images/b05.gif width=152 heigth=25 border=0></a></td></tr>
  <tr><td height=4></td></tr>
 </table>
</td>
<td width=5></td>
<td width=485><img src=images/m10.gif width=244 height=141><img src=images/m11.gif width=241 height=141></td></tr>
<tr><td colspan=3 height=5></td></tr>
<tr><td width=160 valign=top>
 <table cellspacing=0 cellpadding=0 width=160 class=ch5>
  <tr><td height=2></td></tr>
  <tr><td valign=top align=center>
   <table bgcolor=#B3B3B3 cellspacing=0 cellpadding=0 width=148 height=25>
	<tr><td valign=middle class=ch6>   Browse by category</td></tr>
   </table>
  </td></tr>
  <tr><td height=6></td></tr>









<?   // ---- CATEGORIES

 function tep_show_category($counter) {
global $tree, $categories_string, $cPath_array;

  if(!$tree[$counter]['level']){			   

$categories_string .= $categories_string ? '<tr><td background=images/m13.gif width=160 height=1></td></tr><tr><td height=4></td></tr>' : '';			 

$categories_string .= '<tr><td>    <img src=images/m12.gif width=7 height=5 align=absmiddle>    <a class=ml2  href=';

if ($tree[$counter]['parent'] == 0) {
  $cPath_new = 'cPath=' . $counter;
} else {
  $cPath_new = 'cPath=' . $tree[$counter]['path'];
}
$categories_string .= tep_href_link('index.php', $cPath_new) . '>';
// display categry name
$categories_string .= $tree[$counter]['name'];
$categories_string .= ' </a></td></tr><tr><td height=4></td></tr>';

  }else{  // SUBCATEGORY

$categories_string .= '<tr><td>    ';

for($i=0;$i<$tree[$counter]['le vel'];$i++)
 $categories_string .= '   ';

$categories_string .= '    - <a class=ml2 style="font-weight:normal;" href=';   
if ($tree[$counter]['parent'] == 0) {
  $cPath_new = 'cPath=' . $counter;
} else {
  $cPath_new = 'cPath=' . $tree[$counter]['path'];
}
$categories_string .= tep_href_link('index.php', $cPath_new) . '>';
// display category name
$categories_string .= $tree[$counter]['name'];
$categories_string .= ' </a></td></tr><tr><td height=4></td></tr>';
  }  

if ($tree[$counter]['next_id'] != false) {
  tep_show_category($tree[$counter]['next_id']);
}  
 }



 define(TABLE_CATEGORIES, "categories");
 define(TABLE_CATEGORIES_DESCRIPTION, "categories_description");
 $categories_string = '';
 $tree = array();

 $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
 while ($categories = tep_db_fetch_array($categories_query))  {
$tree[$categories['categories_id']] = array('name' => $categories['categories_name'],
											'parent' => $categories['parent_id'],
											'level' => 0,
											'path' => $categories['categories_id'],
											'next_id' => false);

if (isset($parent_id)) {
  $tree[$parent_id]['next_id'] = $categories['categories_id'];
}

$parent_id = $categories['categories_id'];

if (!isset($first_element)) {
  $first_element = $categories['categories_id'];
}
 }

 //------------------------
 if ($cPath) {
$new_path = '';
reset($cPath_array);
while (list($key, $value) = each($cPath_array)) {
  unset($parent_id);
  unset($first_id);
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
  if (tep_db_num_rows($categories_query)) {
	$new_path .= $value;
	while ($row = tep_db_fetch_array($categories_query)) {
	  $tree[$row['categories_id']] = array('name' => $row['categories_name'],
										   'parent' => $row['parent_id'],
										   'level' => $key+1,
										   'path' => $new_path . '_' . $row['categories_id'],
										   'next_id' => false);

	  if (isset($parent_id)) {
		$tree[$parent_id]['next_id'] = $row['categories_id'];
	  }

	  $parent_id = $row['categories_id'];

	  if (!isset($first_id)) {
		$first_id = $row['categories_id'];
	  }

	  $last_id = $row['categories_id'];
	}
	$tree[$last_id]['next_id'] = $tree[$value]['next_id'];
	$tree[$value]['next_id'] = $first_id;
	$new_path .= '_';
  } else {
	break;
  }
}
 }
 $categories_string .=  '';
 tep_show_category($first_element); 
 $categories_string .=  '';

 echo $categories_string;
?>





  <tr><td height=6></td></tr>
 </table>
 <table cellspacing=0 cellpadding=0>
  <tr><td height=5></td></tr>
 </table>
 <table cellspacing=0 cellpadding=0 width=160 class=ch5>
  <tr><td><a href=<?=tep_href_link('index.php','cPath=35')?>><img src=images/m14.gif width=152 height=116 border=0></a></td></tr>
 </table>
</td>
<td width=5></td>
<td width=479 valign=top>

 

 

Footer Code:

 

<?php
/*
 $Id: footer.php,v 1.26 2003/02/10 22:30:54 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
// START STS 4.5
if ($sts->display_template_output) {
// Get content here, in case column_right is not called.
if (!isset($sts->template['content']))
 $sts->restart_capture ('content');
} else {
//END STS
 require(DIR_WS_INCLUDES . 'counter.php');
?>


</td></tr>
<tr><td COLSPAN=3 valign=bottom>
 <table cellspacing=0 cellpadding=0>
  <tr><td colaspan=2 height=6></td></tr>
  <tr><td colspan=2 bgcolor=#E2E2E2 width=650 height=6></td></tr>
  <tr><td height=2></td></tr>
  <tr><td width=350 heigth=52 bgcolor=#EBEBEB>     <img src=images/m27.gif></td>
  <td width=300 height=52 bgcolor=#EBEBEB><div align="right"><span class=ch13>Copyright © 2007 <a href="http://www.NohassleJewelry.com">Nohassle Jewelry</a></span> </div></td></tr>
  <tr><td colspan=2 bgcolor=#EBEBEB width=650 height=5></td></tr>
 </table>
</td></tr>
  </table>
 </td></tr>
 </table>


<?php
 if ($banner = tep_banner_exists('dynamic', '468x50')) {
?>

<br>
<?php
 }
 // START STS 4.1
}
// END STS 4.1
?>

Link to comment
Share on other sites

Guys,

 

Sorry to interrupt, but looking through this thread, it appears to me it might not be a code issue. (although I'm not certain yet)

 

Webamaster, Can you check in your database under the configuration table what the value is set to for the MAX_DISPLAY_SPECIAL_PRODUCTS For some reason it looks like that row has a screwed up variable.

 

Breaking down the following SQL statement ....

select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC limit -9, 9

 

its created in here (as you already know)

 $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

 

the variable that is executing the query is being called and created in the following ...

 

  $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 

so for some reason that 'limit -9,9' is being appended to the query.

 

by default the last 9 is correct, but there that limit -9 is coming from I'm still digging around.

 

- thanks.

Jim

Link to comment
Share on other sites

Guys,

 

Sorry to interrupt, but looking through this thread, it appears to me it might not be a code issue. (although I'm not certain yet)

 

Webamaster, Can you check in your database under the configuration table what the value is set to for the MAX_DISPLAY_SPECIAL_PRODUCTS For some reason it looks like that row has a screwed up variable.

 

Breaking down the following SQL statement ....

select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC limit -9, 9

 

its created in here (as you already know)

 $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

 

the variable that is executing the query is being called and created in the following ...

 

  $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 

so for some reason that 'limit -9,9' is being appended to the query.

 

by default the last 9 is correct, but there that limit -9 is coming from I'm still digging around.

 

- thanks.

Jim

 

The answer may lie within the specials.php file located in the boxes/includes area. I have duplicated the error on my site. I have PM's WebMasterJedi to copy the file so that I can compare my files with theirs.

 

What are your thoughts?

Do or Do Not, there is no try.

Link to comment
Share on other sites

There is no "limit -9, 9"

 

This is why i'm lost... I have no idea where the limit -9, 9 info is coming from.

This is a very old bug that was already addressed in the ms2.2 update of December 12, 2005. Check if that bug is fixed in your code I would suggest.

 

Problem:

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 '-20, 20' at line 1

Solution:

Line 67 in catalog/includes/classes/split_page_results.php must be changed from:

$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;

to:

$this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page;

Line 38 in catalog/admin/includes/classes/split_page_results.php must be changed from:

$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

to:

$sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page;

There have been more things addressed in the updates, like abuse of your contact us page by spammers...

Link to comment
Share on other sites

The answer may lie within the specials.php file located in the boxes/includes area. I have duplicated the error on my site. I have PM's WebMasterJedi to copy the file so that I can compare my files with theirs.

 

What are your thoughts?

 

I started looking at the split_page_results.php late yesterday. When I take the older version (ms2.2) that I have I can reproduce the problem. When I replace it with RC1's version it fixes it.

 

Webmaster, I would recommend downloading a fresh copy of RC1 and look to port over your site, it did fix alot of bugs and vulnerabilities.

 

Regards,

Jim

Link to comment
Share on other sites

Thank you all for your input.. been trouble shooting some other items on other projects.

 

Let me ask this.. I do in fact have old code and need to upgrade.. how do i upgrade without loosing my custom template and all the mods i've installed?

 

thanks

Link to comment
Share on other sites

I think I do have old code... in the top of my index file it says....

 

/*
 $Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 

So back to my question in my last post... how do I upgrade while keeping my template and my mods?

 

Is there a tutorial somewhere for upgrading?

Link to comment
Share on other sites

I think I do have old code... in the top of my index file it says....

 

/*
 $Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 

So back to my question in my last post... how do I upgrade while keeping my template and my mods?

 

Is there a tutorial somewhere for upgrading?

 

Located in the application_top.php, loos for something like this:

 

 

// define the project version

 

define('PROJECT_VERSION', 'osCommerce 2.2-MS2');

 

Should be around line 72 or so.

Do or Do Not, there is no try.

Link to comment
Share on other sites

Guys,

 

Sorry to interrupt, but looking through this thread, it appears to me it might not be a code issue. (although I'm not certain yet)

 

Webamaster, Can you check in your database under the configuration table what the value is set to for the MAX_DISPLAY_SPECIAL_PRODUCTS For some reason it looks like that row has a screwed up variable.

 

Breaking down the following SQL statement ....

select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from products p, products_description pd, specials s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and s.status = '1' order by s.specials_date_added DESC limit -9, 9

 

its created in here (as you already know)

 $specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";

 

the variable that is executing the query is being called and created in the following ...

 

  $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 

so for some reason that 'limit -9,9' is being appended to the query.

 

by default the last 9 is correct, but there that limit -9 is coming from I'm still digging around.

 

- thanks.

Jim

 

Hey disp507,

 

the value is set to nine.. what should I do to fix it?

Link to comment
Share on other sites

Hey disp507,

 

the value is set to nine.. what should I do to fix it?

 

WebMasterJedi,

 

did you receive my last post regarding the problem with your error. I believe I sent a PM as well as a Post.

Do or Do Not, there is no try.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...