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 10 of 10
  1. #1
    New Coder
    Join Date
    Apr 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in

    Hi all!

    I am having a problem, I edited a file which is php and removed some html and replaced it with PHP as I was trying to install something but now I get the following error...

    Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in
    FILE PATH/product_listing.php on line 177

    I have took some of the code out of the file which includes line 177 and put it below...

    Code:
            $list_box_contents[$cur_row][] = array('align' => $lc_align,
                                                   'params' => 'class="productListing-data"',
                                                   'text'  => $lc_text);
            $product_contents[] = $lc_text;       
          }
    
    
          echo '<td width=169 valign=top>
                         <table cellspacing=0 cellpadding=0>
                          <tr><td width=169 height=49>
                               <table cellspacing=0 cellpadding=0 align=center>
                                <tr><td height=10></td></tr>
                                <tr><td align=center style="padding-left:7px;padding-right:7px">'.$product_contents[1].'</td></tr>
                                <tr><td height=6></td></tr>
                               </table>
                          </td></tr>
                          <tr><td>
                               <table cellspacing=0 cellpadding=0 align=center width=115>
                                <tr><td height=5></td></tr>
                                <tr><td>'.$product_contents[0].'</td></tr>
                                <tr><td height=4></td></tr>
                                <tr><td align=right>'.$product_contents[2].'</td></tr>
                               </table>
                          </td></tr>
                          <tr><td width=169 height=15></td></tr>
                          <tr><td height=5></td></tr>
                          <tr><td align=center><a href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image_button('small_view.gif', IMAGE_BUTTON_BUY_NOW) . '</a> &nbsp; 
    if ($productsold ['products_quantity'] > 0)
    {
    $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>&nbsp;';
    }
    else
    {
    $lc_text = '<img src="includes/languages/english/images/buttons/out_stock.gif">';
    }</td></tr>
                         </table>
                        </td>
          ';
          $column ++;
          if ($column >= 3) {
            $rows ++;
            $column = 0;

    Line 177 is...
    if ($productsold ['products_quantity'] > 0)
    Been trying for a while to sort it out and only use forums when I can't do it, any comments given are greatly appreciated!

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    You're missing a ' on the line before, if you had an editor with syntax-highlighting, or had used the 'php' rather than 'code' tags, this would have been immediately obvious.
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #3
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    You seem to be missing an echo statement after your if/else too.

  • #4
    New Coder
    Join Date
    Apr 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for that, you are both correct and It is now displaying as it should although the new code which I put in is not displaying at all, the code which has been changed is below...

    Code:
                          <tr><td align=center><a href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . 
    
    tep_image_button('small_view.gif', IMAGE_BUTTON_BUY_NOW) . '</a> &nbsp'; 
    if ($productsold ['products_quantity'] > 0)
    {
    $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . 
    
    $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>&nbsp;';
    }
    else
    {
    $lc_text = '<img src="includes/languages/english/images/buttons/out_stock.gif">';
    }
    echo '</td></tr>
    If I replaced the
    Code:
    $lc_text
    with echo it shows the soldout image when it isn't meant to, is there any advice on why this is happening?

  • #5
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    From your code it looks like you should be echo()'ing $lc_text after the if/else. If that's what you're talking about, figure out why the statement. $productsold ['products_quantity'] > 0 is false. Post the code where you execute the query and
    PHP Code:
    var_dump($productsold); 
    Is product supposed to be plural?

  • #6
    New Coder
    Join Date
    Apr 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the reply, I tried echoing it like you said and it did display but displayed only the sold out image which isn't meant to happen.

    I am unsure why it is being read as the products being under 0 as they are not and when the added code is removed everything is OK.

    All code is correct as I have installed it on another website but this file has totally been hand coded and none of the original code is there which is why am having this problem.

    Where are you reading
    Code:
    var_dump($productsold);
    ?

    All code and spelling is correct, its just I can't seem to get it to integrate with the current code without running into a problem like the sold out image being displayed when its not meant to be.

  • #7
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    I'm not reading it, I was telling you to add it.

  • #8
    New Coder
    Join Date
    Apr 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oh right, I see.

    Thank you but when I add it I get the following...

    Code:
    array(1) { ["products_quantity"]=>  string(1) "0" }

  • #9
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    There's your answer.. the quantity is 0, so the product is showing as sold out.

  • #10
    New Coder
    Join Date
    Apr 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am very sorry to have wasted your time, you are correct. What it was, was that I had 2 products, 1 I thought was sold out and the other wasn't, turns out they both are. Thank you for your time in helping me solve this problem!


  •  

    Posting Permissions

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