Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

parse error ... please help!


Guest

Recommended Posts

Posted

Hi,

 

I am getting a parse error in this line on the Latest news contribution. Can anyone point me in the right direction.

 

$latest_news_query = tep_db_query(SELECT * from ' . TABLE_LATEST_NEWS . ' WHERE status = 1 ' . ORDER BY date_added DESC LIMIT ' . MAX_DISPLAY_LATEST_NEWS);

 

Ta

Posted

Looks like missing quote(s) mark.

 

Do you have your original select code that we could look at?

Posted

this is the full code on the catalog/modules as sent in the contribution...

 

Is this what you need..

 

on screen it shows

 

Parse error: parse error in /www.yourdomain.com/catalog/includes/modules/latest_news.php on line 16

 

<!-- latest_news //-->

<?php

 

 $latest_news_query = tep_db_query(SELECT * from ' . TABLE_LATEST_NEWS . ' WHERE status = 1 ' . ORDER BY date_added DESC LIMIT ' . MAX_DISPLAY_LATEST_NEWS);



 if (!tep_db_num_rows($latest_news_query)) { // there is no news

   echo '<!-- ' . TEXT_NO_LATEST_NEWS . ' -->';

 } else {

   $info_box_contents = array();

   $info_box_contents[] = array('align' => 'left',

                                'text'  => TABLE_HEADING_LATEST_NEWS);

   new contentBoxHeading($info_box_contents);



   $info_box_contents = array();

   $row = 0;

   while ($latest_news = tep_db_fetch_array($latest_news_query)) {

     $info_box_contents[$row] = array('align' => 'left',

                                      'params' => 'class="smallText" valign="top"',

                                      'text' => '<b>' . $latest_news['headline'] . '</b> - <i>' . tep_date_long($latest_news['date_added']) . '</i><br>' . nl2br($latest_news['content']) . '<br>');

     $row++;

   }

   new contentBox($info_box_contents);

 }

?>

<!-- latest_news_eof //-->

Posted

'text' => '<b>' . $latest_news['headline'] . '</b> - <i>' . tep_date_long($latest_news['date_added']) . '</i><br>' . nl2br($latest_news['content']) . '<br>');

 

should be a single line

"Politics is the art of preventing people from taking part in affairs which properly concern them"

Posted

I believe you are missing the starting quote mark:

 

$latest_news_query = tep_db_query(SELECT * from ' . TABLE_LATEST_NEWS . ' WHERE status = 1 ' . ORDER BY date_added DESC LIMIT ' . MAX_DISPLAY_LATEST_NEWS);

 

Try this one:

 

$latest_news_query = tep_db_query('SELECT * from ' . TABLE_LATEST_NEWS . ' WHERE status = 1 ' . ORDER BY date_added DESC LIMIT ' . MAX_DISPLAY_LATEST_NEWS);

Posted

tried both these and still showing parse error...

Posted

well as soon as you are using tep_db_query() you will get a [TEP STOP] error if the query is incorrect.

Check if there are other lines that are not on a single line...like

'params' => 'class="smallText" valign="top"',

"Politics is the art of preventing people from taking part in affairs which properly concern them"

  • 1 year later...
Posted

same error here:

 

Welcome Guest! Would you like to log yourself in? Or would you prefer to create an account?

 

1064 - You have an error in your SQL syntax near 'MAX_DISPLAY_LATEST_NEWS' at line 1

 

SELECT * from latest_news WHERE status = 1 ORDER BY date_added DESC LIMIT MAX_DISPLAY_LATEST_NEWS

 

[TEP STOP]

 

Should be something in this string:

$latest_news_query = tep_db_query('SELECT * from ' . TABLE_LATEST_NEWS . ' WHERE status = 1 ORDER BY date_added DESC LIMIT ' . MAX_DISPLAY_LATEST_NEWS);

 

the contribution: http://www.oscommerce.com/community/contributions,1451

too shame it is brokn, anyone can help us out?

  • 4 weeks later...
Posted

Using PHPMyAdmin check if you have included in your 'configuration' table this value of 'MAX_DISPLAY_LATEST_NEWS' . The program may be looking for it as a configuration key and it is missing.

Archived

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

×
×
  • Create New...