Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 2 votes

1064 - You have an error in your SQL syntax


355 replies to this topic

#321 ChiefTom500

  • Community Member
  • 9 posts
  • Real Name:Thomas Griffith

Posted 15 November 2009, 23:54

Please help.
I installed a contribution "Product Lead Time" by modifying the required files by adding only the needed language. I also ran the followng SQL query

ALTER TABLE `products` ADD `products_lead_time` INT NOT NULL DEFAULT '0';

Before running the query I backed up my database.

I receved a syntax 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 'p, products_description pd where p.products_id = '328' and p.products_id = pd.pr' at line 1

I could not determine how to remedy this problem so I restored my files back to the way they were. Now I am still getting a syntax error as follows:

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_description pd where p.products_id = '328' and p.products_id = pd.pr' at line 1

select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, products_length, products_width, products_height, products_ready_to_ship, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id fromproducts p, products_description pd where p.products_id = '328' and p.products_id = pd.products_id and pd.language_id = '1'

I am out of options as I have examined my files closely and they are back to the status they were in before I ran the SQL query and changed the files. I have also conducted a restore on my database.

Any help will be appreciated. My store address is www.americanfhb.com
You can email me if needed at tgriffithjr@charter.net

Thanks

#322 ChiefTom500

  • Community Member
  • 9 posts
  • Real Name:Thomas Griffith

Posted 16 November 2009, 00:56

Seems my Admin side is now working but the live store side is not???
Still trying to figure it out. Any ideas from anyone?

View PostChiefTom500, on 15 November 2009, 23:54, said:

Please help.
I installed a contribution "Product Lead Time" by modifying the required files by adding only the needed language. I also ran the followng SQL query

ALTER TABLE `products` ADD `products_lead_time` INT NOT NULL DEFAULT '0';

Before running the query I backed up my database.

I receved a syntax 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 'p, products_description pd where p.products_id = '328' and p.products_id = pd.pr' at line 1

I could not determine how to remedy this problem so I restored my files back to the way they were. Now I am still getting a syntax error as follows:

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_description pd where p.products_id = '328' and p.products_id = pd.pr' at line 1

select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, products_length, products_width, products_height, products_ready_to_ship, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id fromproducts p, products_description pd where p.products_id = '328' and p.products_id = pd.products_id and pd.language_id = '1'

I am out of options as I have examined my files closely and they are back to the status they were in before I ran the SQL query and changed the files. I have also conducted a restore on my database.

Any help will be appreciated. My store address is www.americanfhb.com
You can email me if needed at tgriffithjr@charter.net

Thanks


#323 ChiefTom500

  • Community Member
  • 9 posts
  • Real Name:Thomas Griffith

Posted 16 November 2009, 01:20

Well I fixed it! I noticed a post from someone else that mentioned removing 'white' spaces between coding in the files. Seems when I was adding the contribution I added spaces between some of the lines to help me see the text. I removed all of the blank lines and that made it work. PHP sure is particular! Whew!


View PostChiefTom500, on 16 November 2009, 00:56, said:

Seems my Admin side is now working but the live store side is not???
Still trying to figure it out. Any ideas from anyone?


#324 InternetNets

  • Community Member
  • 1 posts
  • Real Name:Roberto

Posted 17 November 2009, 03:30

Excuse my english i will explain in spanish.

Para mi la solucion a ese error fue editar la base de datos en mysql.
1. Entre a "mysql" mediante "phpadmin"
2. Click en "manufacturers"
3. Click en el tab que dise "insert"
4. En "manufacturers_id" puse (1) y en "manufacturers_name" puse una letra (a)
5. y eso fue todo... luego fui al panel de administracion de oscommerce y edite la informacion del manufacturero.

Esto tambien funciona si usted borro todas las categorias en el panel de administracion de oscommerce y le sale este error. (1064 - You have an error in your SQL syntax). Añadir valor en la base de datos produce que oscommerce pueda leer de la base de datos y no produsca un error.

(editar el .php puede producir una inestabilidad en su pagina).

(http://www.internetnets.com)
webmaster

#325 mdtaylorlrim

  • Community Member
  • 2,497 posts
  • Real Name:Mark
  • Gender:Male

Posted 05 January 2010, 13:19

View PostChiefTom500, on 16 November 2009, 01:20, said:

Well I fixed it! I noticed a post from someone else that mentioned removing 'white' spaces between coding in the files. Seems when I was adding the contribution I added spaces between some of the lines to help me see the text. I removed all of the blank lines and that made it work. PHP sure is particular! Whew!
The only place where php cannot tolerate a white line is the first line of a file, IIRC.


In your sql above that is throwing the error, I see this word: fromproducts

php really *needs* the whitespace there...
Avoid the most asked question. See How to Secure My Site and How do I...?

#326 longhorn1999

  • Community Member
  • 309 posts
  • Real Name:Nick
  • Gender:Male
  • Location:Texas

Posted 18 January 2010, 19:34

Hi everyone,

I'm having this error only with one page checkout when a returning customer logs in and tries to buy something.


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 'where customer_id = '3'' at line 1

select amount from where customer_id = '3'


Sorry to double post but I haven't seen anyone with this exact problem anywhere and it appears to be some database issue outside the scope of that forum. I'm using mySQL 5.1.30 and the split page results fix at the beginning of this forum has already been applied. I triple checked the installation of one page checkout I did. Could this be some strange conflict with purchase without account even though they're supposed to work together? Any ideas would be much appreciated.

Thanks,

Nick

#327 longhorn1999

  • Community Member
  • 309 posts
  • Real Name:Nick
  • Gender:Male
  • Location:Texas

Posted 19 January 2010, 07:37

View Postlonghorn1999, on 18 January 2010, 19:34, said:

Hi everyone,

I'm having this error only with one page checkout when a returning customer logs in and tries to buy something.


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 'where customer_id = '3'' at line 1

select amount from where customer_id = '3'


Sorry to double post but I haven't seen anyone with this exact problem anywhere and it appears to be some database issue outside the scope of that forum. I'm using mySQL 5.1.30 and the split page results fix at the beginning of this forum has already been applied. I triple checked the installation of one page checkout I did. Could this be some strange conflict with purchase without account even though they're supposed to work together? Any ideas would be much appreciated.

Thanks,

Nick


http://forums.oscommerce.com/topic/333292-one-page-checkout-support/page__st__1100__gopid__1476227&#entry1476227


got a solution to my problem...no database problem...just some extra junk code gumming things up.

#328 crust

  • Community Member
  • 56 posts
  • Real Name:justin

Posted 29 March 2010, 07:55

Hi, my 1064 error is a little different.

This is on the catalog side on page one of one of my categories. The rest of the pages seem fine.

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 1<br><br>select filter from products where products_id = ;<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>


Can anyone help figure out what this is about? Thanks.

#329 TracyS

  • Community Member
  • 1,194 posts
  • Real Name:Tracy
  • Gender:Female
  • Location:U.S.

Posted 20 April 2010, 17:16

I'm having an interesting error happening on catalog/shopping_cart.php in the block of code below.

This is happening only on products with attributes and it happens regardless of which attribute is chosen.

The error is:
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 '{1}7' at line 1

SELECT products_master FROM products WHERE products_id = 128{1}7

[TEP STOP]


The query code is:
// Master Products     
    $master_prod = tep_db_query("select products_master, products_master_status from " . TABLE_PRODUCTS . " where products_id = '" . $products[$i]['id'] . "'");
    $master_prod_values = tep_db_fetch_array($master_prod);
    
    if (($master_prod_values['products_master_status'] == 0) && ($master_prod_values['products_master'] != 0)) {
      $prod_link_id = $master_prod_values['products_master'];
    } else { $prod_link_id = $products[$i]['id']; }
     $products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
                      '  <tr>' .
                      '    <td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $prod_link_id) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a></td>' .
                      '    <td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';
//Master Products EOF

I did try changing
where products_id = '" . $products[$i]['id'] . "'
to
where products_id = '" . (int)$products[$i]['id'] . "'
but it did not make a difference.

I also tried the suggestion at the beginning of this forum to change admin/includes/classes/split_page_results.php by adding this blurb
if ($offset < 0)
       {
       $offset = 0 ;
       }

again - this didn't do anything for my issue.

Anyone have any ideas how to fix this? I've been searching the forums and haven't found this particular error anywhere else yet. Thanks in advance for any ideas :)
~Tracy
Currently using: STS v4.5.8 with Header Tags Controller v2.6.3, Master Products v1.2, Separate Pricing Per Customer v 4.1.5, Hide Products and Categories from Customer Groups for SPPC , InfoBox Customizer, Discount Coupon Codes and Exclude Customer Groups for DCC, All Products, Tell Friend About Site too, Scrolling Specials Box, Ultimate SEO URL's, MS2-2.2 SiteMap, Product Sort, Customer Testimonials, Embed Links w/SID in Description, Minimum Order Amount, Free Shipping w/Minimum Amount, Cross Sell for MS2, Super Contact Us Enhancement + antirobot, Anti Robot Registration Validation, Agree2Terms, Customer Registration Report, Sales Report 2, Edit Auto Emails in Admin, Ad Tracker, Visitor Web Stats, Supertracker, Product Listing, Sales Tracker, How Did You Hear About Us, Order Editor, About Us, Country State Selector, Credit Card Number Encryption, Remove Credit Card Numbers, Links Manager II and Google Analytics

#330 TracyS

  • Community Member
  • 1,194 posts
  • Real Name:Tracy
  • Gender:Female
  • Location:U.S.

Posted 20 April 2010, 17:18

Ugh - I keep forgetting to open the options section to check the box to get email replies - sorry for the additional post guys :blush:
~Tracy
Currently using: STS v4.5.8 with Header Tags Controller v2.6.3, Master Products v1.2, Separate Pricing Per Customer v 4.1.5, Hide Products and Categories from Customer Groups for SPPC , InfoBox Customizer, Discount Coupon Codes and Exclude Customer Groups for DCC, All Products, Tell Friend About Site too, Scrolling Specials Box, Ultimate SEO URL's, MS2-2.2 SiteMap, Product Sort, Customer Testimonials, Embed Links w/SID in Description, Minimum Order Amount, Free Shipping w/Minimum Amount, Cross Sell for MS2, Super Contact Us Enhancement + antirobot, Anti Robot Registration Validation, Agree2Terms, Customer Registration Report, Sales Report 2, Edit Auto Emails in Admin, Ad Tracker, Visitor Web Stats, Supertracker, Product Listing, Sales Tracker, How Did You Hear About Us, Order Editor, About Us, Country State Selector, Credit Card Number Encryption, Remove Credit Card Numbers, Links Manager II and Google Analytics

#331 TracyS

  • Community Member
  • 1,194 posts
  • Real Name:Tracy
  • Gender:Female
  • Location:U.S.

Posted 20 April 2010, 17:21

I would start with a file comparison tool (like WinMerge) and compare your catalog/index.php file with the stock osC catalog/index.php file.

View Postcrust, on 29 March 2010, 07:55, said:

Hi, my 1064 error is a little different.

This is on the catalog side on page one of one of my categories. The rest of the pages seem fine.

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 1<br><br>select filter from products where products_id = ;<br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>


Can anyone help figure out what this is about? Thanks.

~Tracy
Currently using: STS v4.5.8 with Header Tags Controller v2.6.3, Master Products v1.2, Separate Pricing Per Customer v 4.1.5, Hide Products and Categories from Customer Groups for SPPC , InfoBox Customizer, Discount Coupon Codes and Exclude Customer Groups for DCC, All Products, Tell Friend About Site too, Scrolling Specials Box, Ultimate SEO URL's, MS2-2.2 SiteMap, Product Sort, Customer Testimonials, Embed Links w/SID in Description, Minimum Order Amount, Free Shipping w/Minimum Amount, Cross Sell for MS2, Super Contact Us Enhancement + antirobot, Anti Robot Registration Validation, Agree2Terms, Customer Registration Report, Sales Report 2, Edit Auto Emails in Admin, Ad Tracker, Visitor Web Stats, Supertracker, Product Listing, Sales Tracker, How Did You Hear About Us, Order Editor, About Us, Country State Selector, Credit Card Number Encryption, Remove Credit Card Numbers, Links Manager II and Google Analytics

#332 TracyS

  • Community Member
  • 1,194 posts
  • Real Name:Tracy
  • Gender:Female
  • Location:U.S.

Posted 21 April 2010, 19:56

I've learned the issue may lie in includes/application_top.php in this bit of code, but I'm not strong enough in PHP or MySQL to determine what bit of code is suddenly generating a 1064 error :blush:

 // customer adds a product from the products page
      case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
                                $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+ $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);
                              }
                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                              break;
     //Master Products
     // customer adds multiple products from the master_listing page
      case 'add_slave' :
                              reset($HTTP_POST_VARS);
                              while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) {
                                if (substr($key,0,11) == "Qty_ProdId_") {
                                  $prodId = substr($key,11);
                                  $qty = $val;
								  // if zero: go to the next HTTP_POST_VARS on next line
								  if ($qty <= 0) continue;
                                  if(isset($HTTP_POST_VARS["id_$prodId"]) && is_array($HTTP_POST_VARS["id_$prodId"])) {
                                    // We have attributes
                                    $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId,$HTTP_POST_VARS["id_$prodId"]))+$qty, $HTTP_POST_VARS["id_$prodId"]);
                                  } else {
                                    // No attributes
                                    $cart->add_cart($prodId, $cart->get_quantity($prodId)+$qty);
                                  }
                                }
                              }
                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                              break;
     //Master Products EOF
      // performed by the 'buy now' button in product listings and review page
      case 'buy_now' :        if (isset($HTTP_GET_VARS['products_id'])) {
                                if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
                                  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
                                } else {
                                  $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
                                }
                              }
                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                              break;
      case 'notify' :         if (tep_session_is_registered('customer_id')) {
                                if (isset($HTTP_GET_VARS['products_id'])) {
                                  $notify = $HTTP_GET_VARS['products_id'];
                                } elseif (isset($HTTP_GET_VARS['notify'])) {
                                  $notify = $HTTP_GET_VARS['notify'];
                                } elseif (isset($HTTP_POST_VARS['notify'])) {
                                  $notify = $HTTP_POST_VARS['notify'];
                                } else {
                                  tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));
                                }
                                if (!is_array($notify)) $notify = array($notify);
                                for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
                                  $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $notify[$i] . "' and customers_id = '" . $customer_id . "'");
                                  $check = tep_db_fetch_array($check_query);
          // BOF SPPC, Hide products and categories from groups
          if (is_array($hide_status_products) && tep_not_null($hide_status_products)) {
          	foreach($hide_status_products as $key => $subarray) {
          		if ($subarray['products_id'] == tep_get_prid($notify[$i]) && $subarray['hidden'] == '0') {
                                  if ($check['count'] < 1) {
                                    tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())");
                                  }
                                } // end if ($subarray['products_id'] == tep_get_prid($notify[$i])...
                            } // end foreach ($hide_status_products as $key => $subarray)
                        } else {
                        	if ($check['count'] < 1) {
                        		tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())");
                        	}
                    }
                // EOF SPPC, Hide products and categories from groups
                              }

                                tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));
                              } else {
                                $navigation->set_snapshot();
                                tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
                              }
                              break;
      case 'notify_remove' :  if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['products_id'])) {
                                $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                                $check = tep_db_fetch_array($check_query);
                                if ($check['count'] > 0) {
                                  tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                                }
                                tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))));
                              } else {
                                $navigation->set_snapshot();
                                tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
                              }
                              break;
      case 'cust_order' :     if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {
                                if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {
                                  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));
                                } else {
                                  $cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);
                                }
                              }
                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                              break;
    } // end switch
// BOF Separate Pricing Per Customer v4.1, Hide products from groups mod
    } else { // $hide_product is true
       tep_redirect(tep_href_link(FILENAME_DEFAULT));
  }
// EOF Separate Pricing Per Customer v4.1, Hide products from groups mod
} // if (isset($HTTP_GET_VARS['action']))

Does anything in there look to you like it would be the culprit?

View PostTracyS, on 20 April 2010, 17:16, said:

I'm having an interesting error happening on catalog/shopping_cart.php in the block of code below.

This is happening only on products with attributes and it happens regardless of which attribute is chosen.

The error is:
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 '{1}7' at line 1

SELECT products_master FROM products WHERE products_id = 128{1}7

[TEP STOP]

~Tracy
Currently using: STS v4.5.8 with Header Tags Controller v2.6.3, Master Products v1.2, Separate Pricing Per Customer v 4.1.5, Hide Products and Categories from Customer Groups for SPPC , InfoBox Customizer, Discount Coupon Codes and Exclude Customer Groups for DCC, All Products, Tell Friend About Site too, Scrolling Specials Box, Ultimate SEO URL's, MS2-2.2 SiteMap, Product Sort, Customer Testimonials, Embed Links w/SID in Description, Minimum Order Amount, Free Shipping w/Minimum Amount, Cross Sell for MS2, Super Contact Us Enhancement + antirobot, Anti Robot Registration Validation, Agree2Terms, Customer Registration Report, Sales Report 2, Edit Auto Emails in Admin, Ad Tracker, Visitor Web Stats, Supertracker, Product Listing, Sales Tracker, How Did You Hear About Us, Order Editor, About Us, Country State Selector, Credit Card Number Encryption, Remove Credit Card Numbers, Links Manager II and Google Analytics

#333 TracyS

  • Community Member
  • 1,194 posts
  • Real Name:Tracy
  • Gender:Female
  • Location:U.S.

Posted 26 April 2010, 17:14

Anybody? I still have no idea why this isn't working, and it does have our top selling product unable to be ordered through the site right now :( Any thoughts on what bit of code is incorrect with MySQL 5.0.89 would be greatly appreciated.

You can see this in action at mountainmeadowherbs.com/gentle-birth-formula-p-31.html - try adding it to the cart and you'll see the error.

View PostTracyS, on 21 April 2010, 19:56, said:

I've learned the issue may lie in includes/application_top.php in this bit of code, but I'm not strong enough in PHP or MySQL to determine what bit of code is suddenly generating a 1064 error :blush:

 // customer adds a product from the products page
      case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
                                $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+ $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);
                              }
                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                              break;
     //Master Products
     // customer adds multiple products from the master_listing page
      case 'add_slave' :
                              reset($HTTP_POST_VARS);
                              while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) {
                                if (substr($key,0,11) == "Qty_ProdId_") {
                                  $prodId = substr($key,11);
                                  $qty = $val;
								  // if zero: go to the next HTTP_POST_VARS on next line
								  if ($qty <= 0) continue;
                                  if(isset($HTTP_POST_VARS["id_$prodId"]) && is_array($HTTP_POST_VARS["id_$prodId"])) {
                                    // We have attributes
                                    $cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId,$HTTP_POST_VARS["id_$prodId"]))+$qty, $HTTP_POST_VARS["id_$prodId"]);
                                  } else {
                                    // No attributes
                                    $cart->add_cart($prodId, $cart->get_quantity($prodId)+$qty);
                                  }
                                }
                              }
                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                              break;
     //Master Products EOF
      // performed by the 'buy now' button in product listings and review page
      case 'buy_now' :        if (isset($HTTP_GET_VARS['products_id'])) {
                                if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
                                  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
                                } else {
                                  $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
                                }
                              }
                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                              break;
      case 'notify' :         if (tep_session_is_registered('customer_id')) {
                                if (isset($HTTP_GET_VARS['products_id'])) {
                                  $notify = $HTTP_GET_VARS['products_id'];
                                } elseif (isset($HTTP_GET_VARS['notify'])) {
                                  $notify = $HTTP_GET_VARS['notify'];
                                } elseif (isset($HTTP_POST_VARS['notify'])) {
                                  $notify = $HTTP_POST_VARS['notify'];
                                } else {
                                  tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));
                                }
                                if (!is_array($notify)) $notify = array($notify);
                                for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
                                  $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $notify[$i] . "' and customers_id = '" . $customer_id . "'");
                                  $check = tep_db_fetch_array($check_query);
          // BOF SPPC, Hide products and categories from groups
          if (is_array($hide_status_products) && tep_not_null($hide_status_products)) {
          	foreach($hide_status_products as $key => $subarray) {
          		if ($subarray['products_id'] == tep_get_prid($notify[$i]) && $subarray['hidden'] == '0') {
                                  if ($check['count'] < 1) {
                                    tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())");
                                  }
                                } // end if ($subarray['products_id'] == tep_get_prid($notify[$i])...
                            } // end foreach ($hide_status_products as $key => $subarray)
                        } else {
                        	if ($check['count'] < 1) {
                        		tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())");
                        	}
                    }
                // EOF SPPC, Hide products and categories from groups
                              }

                                tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));
                              } else {
                                $navigation->set_snapshot();
                                tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
                              }
                              break;
      case 'notify_remove' :  if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['products_id'])) {
                                $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                                $check = tep_db_fetch_array($check_query);
                                if ($check['count'] > 0) {
                                  tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                                }
                                tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))));
                              } else {
                                $navigation->set_snapshot();
                                tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
                              }
                              break;
      case 'cust_order' :     if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {
                                if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {
                                  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));
                                } else {
                                  $cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);
                                }
                              }
                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                              break;
    } // end switch
// BOF Separate Pricing Per Customer v4.1, Hide products from groups mod
    } else { // $hide_product is true
       tep_redirect(tep_href_link(FILENAME_DEFAULT));
  }
// EOF Separate Pricing Per Customer v4.1, Hide products from groups mod
} // if (isset($HTTP_GET_VARS['action']))

Does anything in there look to you like it would be the culprit?

~Tracy
Currently using: STS v4.5.8 with Header Tags Controller v2.6.3, Master Products v1.2, Separate Pricing Per Customer v 4.1.5, Hide Products and Categories from Customer Groups for SPPC , InfoBox Customizer, Discount Coupon Codes and Exclude Customer Groups for DCC, All Products, Tell Friend About Site too, Scrolling Specials Box, Ultimate SEO URL's, MS2-2.2 SiteMap, Product Sort, Customer Testimonials, Embed Links w/SID in Description, Minimum Order Amount, Free Shipping w/Minimum Amount, Cross Sell for MS2, Super Contact Us Enhancement + antirobot, Anti Robot Registration Validation, Agree2Terms, Customer Registration Report, Sales Report 2, Edit Auto Emails in Admin, Ad Tracker, Visitor Web Stats, Supertracker, Product Listing, Sales Tracker, How Did You Hear About Us, Order Editor, About Us, Country State Selector, Credit Card Number Encryption, Remove Credit Card Numbers, Links Manager II and Google Analytics

#334 burt

  • Community Member
  • 6,765 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEVon/NULL -> get it, hardeharhar.

Posted 27 April 2010, 07:53

I already gave you the answer to your problem.

You need to strip the attributes from the product ID.

I even gave you the right code to search the forum for.
Me page.

#335 TracyS

  • Community Member
  • 1,194 posts
  • Real Name:Tracy
  • Gender:Female
  • Location:U.S.

Posted 27 April 2010, 14:48

I did search the forums for the tep_get_uprid and that is what pointed me to the application_top section of code I posted - however, the only fixes I could find for that bit of code had already been applied or caused even more problems to the online store. That is why I then posted my application_top.php add_product, add_slave etc.. tidbits of code to see if anyone can tell what is wrong? Is that where the problem is in my situation? How do you "strip" the attributes from the product ID and still send them to the shopping cart?

View Postburt, on 27 April 2010, 07:53, said:

I already gave you the answer to your problem.

You need to strip the attributes from the product ID.

I even gave you the right code to search the forum for.

~Tracy
Currently using: STS v4.5.8 with Header Tags Controller v2.6.3, Master Products v1.2, Separate Pricing Per Customer v 4.1.5, Hide Products and Categories from Customer Groups for SPPC , InfoBox Customizer, Discount Coupon Codes and Exclude Customer Groups for DCC, All Products, Tell Friend About Site too, Scrolling Specials Box, Ultimate SEO URL's, MS2-2.2 SiteMap, Product Sort, Customer Testimonials, Embed Links w/SID in Description, Minimum Order Amount, Free Shipping w/Minimum Amount, Cross Sell for MS2, Super Contact Us Enhancement + antirobot, Anti Robot Registration Validation, Agree2Terms, Customer Registration Report, Sales Report 2, Edit Auto Emails in Admin, Ad Tracker, Visitor Web Stats, Supertracker, Product Listing, Sales Tracker, How Did You Hear About Us, Order Editor, About Us, Country State Selector, Credit Card Number Encryption, Remove Credit Card Numbers, Links Manager II and Google Analytics

#336 webmasterd

  • Community Member
  • 1 posts
  • Real Name:Luis Estrella Reynoso

Posted 29 April 2010, 14:26

That´s very fine!, that´s OK!

I could fix the 1064 error !! :thumbsup:

Edited by webmasterd, 29 April 2010, 14:28.


#337 TracyS

  • Community Member
  • 1,194 posts
  • Real Name:Tracy
  • Gender:Female
  • Location:U.S.

Posted 29 April 2010, 15:08

Which 1064 error could you fix and what was the fix?

View Postwebmasterd, on 29 April 2010, 14:26, said:

That´s very fine!, that´s OK!

I could fix the 1064 error !! :thumbsup:

~Tracy
Currently using: STS v4.5.8 with Header Tags Controller v2.6.3, Master Products v1.2, Separate Pricing Per Customer v 4.1.5, Hide Products and Categories from Customer Groups for SPPC , InfoBox Customizer, Discount Coupon Codes and Exclude Customer Groups for DCC, All Products, Tell Friend About Site too, Scrolling Specials Box, Ultimate SEO URL's, MS2-2.2 SiteMap, Product Sort, Customer Testimonials, Embed Links w/SID in Description, Minimum Order Amount, Free Shipping w/Minimum Amount, Cross Sell for MS2, Super Contact Us Enhancement + antirobot, Anti Robot Registration Validation, Agree2Terms, Customer Registration Report, Sales Report 2, Edit Auto Emails in Admin, Ad Tracker, Visitor Web Stats, Supertracker, Product Listing, Sales Tracker, How Did You Hear About Us, Order Editor, About Us, Country State Selector, Credit Card Number Encryption, Remove Credit Card Numbers, Links Manager II and Google Analytics

#338 Jan Zonjee

  • Team Member
  • 6,975 posts
  • Real Name:Jan Zonjee
  • Gender:Male
  • Location:the Netherlands

Posted 29 April 2010, 19:33

View PostTracyS, on 27 April 2010, 14:48, said:

How do you "strip" the attributes from the product ID and still send them to the shopping cart?
By casting it to an integer is one (simplest) way. The query you mention is the same as one in modules/master_products.php but that one isn't used in the shopping cart and it already uses casting to an integer. In the shopping cart modules/product_listing.php is used though.

If you downloaded the source code of your shop most text editors (at least the ones I use and have used) allow you to search for a phrase in a directory and it's subdirectories. It should be simple to find the "SELECT product_master FROM".

#339 samlemine

  • Community Member
  • 2 posts
  • Real Name:SidAhmed

Posted 14 May 2010, 08:44

View PostSimplyeasier, on 01 April 2005, 09:10, said:

Hi

First off - this fix is actually already recorded in the contributions section and many thanks to those who recorded it - but I don't think it is a contribution - rather a tip - Secondly the same problem has arisen for 4 people in a few days and I dare say it will happen to more as hosts migrate their mySQL databases to version 4.1.xx -

Hence I post here :D

If you get an error whilst creating \ modifying your database such that thro admin you delete all entries on a particular table you will likely get this 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 '-20, 20' at line 1

followed by something like

select manufacturers_id, manufacturers_name, manufacturers_image, date_added, last_modified from manufacturers order by manufacturers_name limit -20, 20

or

select banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added from banners order by banners_title, banners_group limit -20, 20

depending on which table you have deleted all records from.

To fix this

In admin/includes/classes find split_page_results.php and - BACK IT UP then find the lines

$offset = ($max_rows_per_page * ($current_page_number - 1));
$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;

change to

$offset = ($max_rows_per_page * ($current_page_number - 1));
  if ($offset < 0)
	{
	$offset = 0;
	}
$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;


MySQL 4.1.xx handles negatives correctly (by forcing an error) in the code above unlike earlier versions of MySQL.

:o NOTE - I have NOT asked you to change catalog/includes/classes/split_page_results.php - If you have a problem on the catalog side you may want to try the same change in that file - I did and it went wrong so the change to my catalog/includes/classes/split_page_results.php file is a little more elaborate and I will share that here if it becomes an issue - but for now it seems people will mostly have a problem with empty files on the admin side.

Change (catalog/includes/classes/split_page_results.php around line 67) 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;

Both on the catalog side and the admin side changing $offset to max($offset, 0) is the "official" fix.

hth

Charles

Hello All guys

thank you so much after 5 years. i had this problem in 2010 and the solution was in 2005 so thank u so much again Mr Simplyeasier

Regards

#340 TracyS

  • Community Member
  • 1,194 posts
  • Real Name:Tracy
  • Gender:Female
  • Location:U.S.

Posted 14 May 2010, 14:23

Thanks Jan,

I found the offending query in the cross sell contribution code I have for the shopping cart page - it needed a single quote by the double quote and then it worked. YAY!

As for casting the product id to an integer - is that done by simply putting (int) in front of products_id so the query would have (int)products_id ?

View PostJan Zonjee, on 29 April 2010, 19:33, said:

By casting it to an integer is one (simplest) way. The query you mention is the same as one in modules/master_products.php but that one isn't used in the shopping cart and it already uses casting to an integer. In the shopping cart modules/product_listing.php is used though.

If you downloaded the source code of your shop most text editors (at least the ones I use and have used) allow you to search for a phrase in a directory and it's subdirectories. It should be simple to find the "SELECT product_master FROM".

~Tracy
Currently using: STS v4.5.8 with Header Tags Controller v2.6.3, Master Products v1.2, Separate Pricing Per Customer v 4.1.5, Hide Products and Categories from Customer Groups for SPPC , InfoBox Customizer, Discount Coupon Codes and Exclude Customer Groups for DCC, All Products, Tell Friend About Site too, Scrolling Specials Box, Ultimate SEO URL's, MS2-2.2 SiteMap, Product Sort, Customer Testimonials, Embed Links w/SID in Description, Minimum Order Amount, Free Shipping w/Minimum Amount, Cross Sell for MS2, Super Contact Us Enhancement + antirobot, Anti Robot Registration Validation, Agree2Terms, Customer Registration Report, Sales Report 2, Edit Auto Emails in Admin, Ad Tracker, Visitor Web Stats, Supertracker, Product Listing, Sales Tracker, How Did You Hear About Us, Order Editor, About Us, Country State Selector, Credit Card Number Encryption, Remove Credit Card Numbers, Links Manager II and Google Analytics