...

View Full Version : PHP Parser Error



chargedRam
03-26-2007, 08:31 PM
Hi guys...

I am getting this wierd error

PHP Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in specials.php on line 22.

And the code is


<?php
/*
$Id: specials.php,v 1.31 2003/06/09 22:21:03 hpdl Exp $

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

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

if ($random_product = tep_random_select("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 p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {
?>
<!-- specials //-->
<tr>
<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_SPECIALS);
new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SPECIALS));
if ("$random_product['specials_new_products_price']" == "666.66"){
$random_product['specials_new_products_price'] = "Call for price";
}

$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product["products_id"]) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br><s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>');

new infoBox($info_box_contents);
?>
</td>
</tr>
<!-- specials_eof //-->
<?php
}
?>





Pls help guys.....

_Aerospace_Eng_
03-26-2007, 08:35 PM
No need to type so big. In your first if statement you have things like

TABLE_PRODUCTS_DESCRIPTION
What are those? They don't appear to be variables so PHP is parsing them as normal text causing the error. Perhaps try something like this. They seem like names of TABLES in which case you don't need to concatenate them the way they are.

if ($random_product = tep_random_select("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 p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS)) {

chargedRam
03-26-2007, 08:48 PM
hi,,

first of all thank you for heping me.. and sorry for writing in this manner.

I dont know what is


TABLE_PRODUCTS_DESCRIPTION

Actually I havent coded this file.. I was just troubleshooting something else.. and this error popped up...

I will try to do what u have suggested and will be back...

Thx again

Inigoesdr
03-27-2007, 04:01 AM
They're probably defined constants. Anyway, your problem is here:
if ($random_product['specials_new_products_price'] == "666.66"){
Remove the double quotes around the $random_product.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum