Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Getting syntax error??


Guest

Recommended Posts

Hello,

 

First off, I thank everyone for taking time in reading my post. People at this forum are freindly.

 

Let me describe to you what has happened. My freind had to move his website from one host to another. I downloaded all his files and uploaded them to another server. I copied the data structer including the data of the mysql database and put it up on the new server. Everything is the same (config file, db connections- they are all fine) but except when i go to the main page i get this 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 'MAX_RANDOM_SELECT_NEW' at line 1

select products_id, products_image, products_tax_class_id, products_price from products where products_status = '1' order by products_date_added desc limit MAX_RANDOM_SELECT_NEW

[TEP STOP]

 

I have never encoutered this error before, I dont know what it is and I dont know how to fix it. I am a total new b to oscommerce and have searched this forum alot for this help but couldnt find any or maybe i just couldnt understand :(.

 

Thank you in advance for your help.

Link to comment
Share on other sites

MAX_RANDOM_SELECT_NEW is defined from a database entry.

 

Now, usually that is handled in application_top.php with this code around line 67:

// set the application parameters
 $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
 while ($configuration = tep_db_fetch_array($configuration_query)) {
   define($configuration['cfgKey'], $configuration['cfgValue']);
 }

Notice it pulls the configuration values and then creates a define statment for each one.

 

Your SQL indicates that MAX_RANDOM_SELECT_NEW is not being defined and is simply outputting the text (and not the defined value). I would start by saving the defined configuration values in an array and then print_r them just to check.

 

Bobby

Link to comment
Share on other sites

To grab them all use this code:

// set the application parameters
$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
$container = array();
while ($configuration = tep_db_fetch_array($configuration_query)) {
  define($configuration['cfgKey'], $configuration['cfgValue']);
  $container[$configuration['cfgKey']] = $configuration['cfgValue'];
}

This will grab all the configuration keys and their values.

 

If you want to limit it to a certain key then use this:

// set the application parameters
$configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
$container = array();
while ($configuration = tep_db_fetch_array($configuration_query)) {
  define($configuration['cfgKey'], $configuration['cfgValue']);

  if ($configuration['cfgKey'] == 'MAX_RANDOM_SELECT_NEW'){
   $container[$configuration['cfgKey']] = $configuration['cfgValue'];
  }
}

This will only set the array if the key is found...a little bit more surgical.

 

Then somewhere (application_bottom.php?) use this to output:

 echo '<pre>';
print_r($container);
echo '</pre>';

Link to comment
Share on other sites

Hello,

 

I got it to work. You were right the table was empty I had to populate again and insert all the iformation again.

 

I have another question. When I use ssl for shooping cart do I have to set that up in my cpanel.

Link to comment
Share on other sites

Want to pay me back? Learn as much about osCommerce as your brain will allow before saturation and meltdown and come here and help answer questions.

 

Bobby

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...