Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Parser Error

    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 Code:
    <?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_contentsfalsefalsetep_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_WIDTHSMALL_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.....

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    No need to type so big. In your first if statement you have things like
    Code:
    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.
    PHP Code:
      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)) { 
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hi,,

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

    I dont know what is

    Code:
    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

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    They're probably defined constants. Anyway, your problem is here:
    PHP Code:
    if ($random_product['specials_new_products_price'] == "666.66"){ 
    Remove the double quotes around the $random_product.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •