Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Parse error: syntax error, unexpected $end in /public_html/specials.php on line 137


Azure Moon

Recommended Posts

Posted

Hi Everyone!

 

I'm getting an error message when I click on my specials page in my site map:

 

Parse error: syntax error, unexpected $end in /public_html/specials.php on line 137

 

Here is that particular line of code:

 

== '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {

 

 

Can anyone tell me what the error is? Any and all help will be greatly appreicated.

 

Brightest Blessings,

 

Azure Moon

Posted

it usually means you are missing a closing curly brace "}"

post your entire code for the page and we can see where it is missing from

Nic

Sometimes you're the dog and sometimes the lamp post

[/url]

My Contributions

Posted
Hi Everyone!

 

I'm getting an error message when I click on my specials page in my site map:

 

Parse error: syntax error, unexpected $end in /public_html/specials.php on line 137

 

Here is that particular line of code:

 

== '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {

 

 

Can anyone tell me what the error is? Any and all help will be greatly appreicated.

 

Brightest Blessings,

 

Azure Moon

 

Supply about 10 lines above and ten lines below indicating which is (line 137) otherwise no one can help

Posted
Supply about 10 lines above and ten lines below indicating which is (line 137) otherwise no one can help

 

Here is the entire public_html/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>

<?php

// BOF: Header Tag Controller v2.6.0

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?>

<title><?php echo TITLE; ?></title>

<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="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

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

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

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

<tr>

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

<tr>

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

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_specials.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</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" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></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>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

}

?>

<tr>

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

<tr>

<?php

$row = 0;

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

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

$row++;

 

echo ' <td align="center" width="33%" class="smallText"><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><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . $specials['products_name'] . '</a><br><s>' . $currencies->display_price($specials['products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($specials['specials_new_products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</span></td>' . "\n";

 

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

?>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<?php

}

}

?>

</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" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></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

}

?>

</table></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

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

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

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

<!-- footer_eof //-->

<br>

</body>

</html>

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

Posted

I'd say this code:

 

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
require(DIR_WS_INCLUDES . 'header_tags.php');
} else {

Needs to be:

 

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
require(DIR_WS_INCLUDES . 'header_tags.php');
}

You ever get the admin font problem ironed out?

:unsure:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Posted
I'd say this code:

 

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
require(DIR_WS_INCLUDES . 'header_tags.php');
} else {

Needs to be:

 

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
require(DIR_WS_INCLUDES . 'header_tags.php');
}

You ever get the admin font problem ironed out?

:unsure:

 

Hi Germ!

 

Thanks for your reply : ) Forgive my ignorance, but the error message says there's a problem on line 137. The piece of code you put in your reply is on 27. My knowledge of all this coding is really minimal, so could the error message I get be wrong? Please advise. And no - I'm still working on the font problem - ARGH!

 

Brightest Blessings,

 

Azure Moon

Posted

Try my fix (backup the file first). I think you'll be pleasantly surprised.

 

PHP is just telling you where it THINKS the error is.

 

Admin problems are a real bear 'cuz you can't give anyone a link and say, "Look here!".

:(

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Posted
Try my fix (backup the file first). I think you'll be pleasantly surprised.

 

PHP is just telling you where it THINKS the error is.

 

Admin problems are a real bear 'cuz you can't give anyone a link and say, "Look here!".

:(

 

OMG! You were right!!! Thank you, thank you, thank you!!! There is however, [TEP STOP] in red about a quarter of the way down the page. Does that appear because nothing is on special/sale? If not, how do I remove that? Please advise.

 

Brightest Blessings,

 

Azure Moon

 

P.S.

 

I wish I could download your brain...LOL!!!

Posted
I wish I could download your brain...LOL!!!

All you need is a pair of tweezers and a magnifying glass to find it first...

:blink:

 

Click and drag your mouse across the center section of your page and the full extent of the problem appears:

 

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]

(The text is the same color as the background).

 

Since I'm basically MYSQL illiterate, I'll have to let Nic or Robert or someone else step in...

:blush:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Posted
All you need is a pair of tweezers and a magnifying glass to find it first...

:blink:

 

Click and drag your mouse across the center section of your page and the full extent of the problem appears:

 

 

(The text is the same color as the background).

 

Since I'm basically MYSQL illiterate, I'll have to let Nic or Robert or someone else step in...

:blush:

 

Germ,

 

Never mind - the [TEP STOP] appears when there is nothing on special/on sale. I just put one product on sale and it disappeared. I should have tried that first, but I thought I'd ask you right away as long as I had your attention...LOL!

 

Thank you again for all of your help and instructions as to how to find "the full extent of the problem" - YOU ROCK!!! Now all I have to figure out is how to remove all the letter N's that appear on the checkout confirmation page and fix the font issue with my admin and packing slips. The quest continues....

 

Brightest Blessings,

 

Azure Moon

Posted

If I'm not mistaken, the "letter N issue" is (or can be) caused by editing a PHP file with the osC File Mangler Manager.

 

If you've been using it, I'd halt and desist.

:o

 

Use your cPanel editor or download the file and use a simple text editor like Wordpad (NOT WORD!) to make changes then upload the file back where you got it.

 

Always backup before editing.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Posted
If I'm not mistaken, the "letter N issue" is (or can be) caused by editing a PHP file with the osC File Mangler Manager.

 

If you've been using it, I'd halt and desist.

:o

 

Use your cPanel editor or download the file and use a simple text editor like Wordpad (NOT WORD!) to make changes then upload the file back where you got it.

 

Always backup before editing.

 

Germ,

 

Thanks for the reminder to NEVER use the OsC File Manager - I learned that hard lesson a looooong time ago and I haven't used it since. I use my cPanel and Notepad or Edit Pad Lite and I haven't done anything to the checkout confirmation file for well over a year, so I'm stumped as to why those letter N's would show up now. That page must be in cohoots with my admin and packing slips font sizes...LOL! Again, I guess the quest continues....

 

Brightest Blessings,

 

Azure Moon

Posted
Germ,

 

Thanks for the reminder to NEVER use the OsC File Manager - I learned that hard lesson a looooong time ago and I haven't used it since. I use my cPanel and Notepad or Edit Pad Lite and I haven't done anything to the checkout confirmation file for well over a year, so I'm stumped as to why those letter N's would show up now. That page must be in cohoots with my admin and packing slips font sizes...LOL! Again, I guess the quest continues....

 

Brightest Blessings,

 

Azure Moon

 

Hi Everyone!

 

Does anyone know how to remove the N's on the checkout confirmation page? As I stated above, I haven't made any changes to the catalog/checkout_confirmation.php file in well over a year and I have no clue as to why they are there or how to remove them. Please excuse my ignorance, but I've searched both checkout confirmation files and I don't see N's anywhere, so I'm guessing that I'm missing something somewhere. As always, any and all help is great appreciated!

 

Brightest Blessings,

 

Azure Moon

Posted
Hi Everyone!

 

Does anyone know how to remove the N's on the checkout confirmation page? As I stated above, I haven't made any changes to the catalog/checkout_confirmation.php file in well over a year and I have no clue as to why they are there or how to remove them. Please excuse my ignorance, but I've searched both checkout confirmation files and I don't see N's anywhere, so I'm guessing that I'm missing something somewhere. As always, any and all help is great appreciated!

 

Brightest Blessings,

 

Azure Moon

 

Hi Again everyone!

 

I finally found them! So in case someone else is experiencing N's showing up on their Checkout Confirmation page, you have to change all the "n" in the code to "\n" . There should be five of them that need changing.

 

Now I'm not exactly sure how to post the "find line" and "change to" stuff correctly, so here goes.

 

In your catalog/checkout_confirmation.php file and on about line 211 through 238 find the following code:

 

 

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

echo ' <tr>' . "n" .

' <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "n" .

' <td class="main" valign="top">' . $order->products[$i]['name'];

 

if (STOCK_CHECK == 'true') {

echo tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);

}

 

if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {

for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';

}

}

 

echo '</td>' . "n";

 

if (sizeof($order->info['tax_groups']) > 1) echo ' <td class="main" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "n";

 

echo ' <td class="main" align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . '</td>' . "n" .

' </tr>' . "n";

 

 

AND REPLACE WITH:

 

 

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

echo ' <tr>' . "\n" .

' <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .

' <td class="main" valign="top">' . $order->products[$i]['name'];

 

if (STOCK_CHECK == 'true') {

echo tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);

}

 

if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {

for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';

}

}

 

echo '</td>' . "\n";

 

if (sizeof($order->info['tax_groups']) > 1) echo ' <td class="main" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n";

 

echo ' <td class="main" align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . '</td>' . "\n" .

' </tr>' . "\n";

 

 

I hope this helps someone else in the future!

 

Brightest Blessings,

 

Azure Moon

Posted

Just for future reference, somewhere, somehow your code file(s) got messed up during an upload/download, or more likely, editing in a bad editor. The '\n' (backslash-n) got corrupted into just 'n'. I've seen this happen when people use word processors (such as Word) to edit files. Make sure you use a real file editor, not a word processor, to edit files! ViM and Notepad++ are highly recommended, but in a pinch even Notepad should work.

Archived

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

×
×
  • Create New...