...

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



Richard_1010
11-25-2007, 06:28 PM
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...


$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!

GJay
11-25-2007, 06:38 PM
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.

Inigoesdr
11-25-2007, 06:57 PM
You seem to be missing an echo statement after your if/else too.

Richard_1010
11-25-2007, 07:29 PM
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...


<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
$lc_text with echo it shows the soldout image when it isn't meant to, is there any advice on why this is happening?

Inigoesdr
11-25-2007, 07:57 PM
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

var_dump($productsold);
Is product supposed to be plural?

Richard_1010
11-25-2007, 10:42 PM
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
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.

Inigoesdr
11-26-2007, 12:29 AM
I'm not reading it, I was telling you to add it.

Richard_1010
11-26-2007, 02:11 AM
Oh right, I see.

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


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

Inigoesdr
11-26-2007, 02:20 AM
There's your answer.. the quantity is 0, so the product is showing as sold out.

Richard_1010
11-26-2007, 07:40 AM
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!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum