Page 1 of 1

PHP Parse error: syntax error, unexpected '='

Posted: Thu Mar 06, 2008 4:56 pm
by mexaros
I am relatively new to php and am updating a site for a company. However whenever i try to load the site i recieve this error:
PHP Parse error: syntax error, unexpected '=' in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\neighbours\\include\\left.php on line 67

Here is the code(line 67 highlighted in red):
while($row=$db->fetchArray($rec1))
{
//echo $row['product_name'];
?>
<tr>
<td align="left" class="text-9">
<a href="showoption.php?itid=<?php =$row['prod_id']?>&cat=<?php =$row['cat_id']?>">

<!-- <a href="products.php?mode=prod&prodid=&cat=<?php =$row['prod_id']?>"> --><?php echo $row['product_name'];?></a></td>
<td width="16%" align="center" class="text-9"><img src="images/arrow.jpg" width="7" height="6" /></td>
</tr>
<?php
}
$sql="select * from tbl_product";
$rec1=$db->query($sql);
$total_records=$db->numRows();
if($total_records>=20)
{
?>


could someone tell me why this is?

Re: PHP Parse error: syntax error, unexpected '='

Posted: Thu Mar 06, 2008 5:24 pm
by HCBen
I believe the space before the equal sign is the problem. Remove the space between <?php and =

-Ben

Re: PHP Parse error: syntax error, unexpected '='

Posted: Thu Mar 06, 2008 7:40 pm
by hawkenterprises
does <?php= work I thought only <?= works and that's only if you have short tags enabled.

Re: PHP Parse error: syntax error, unexpected '='

Posted: Thu Mar 06, 2008 7:53 pm
by HCBen
Not sure if it works with short-tags disabled, I can't imagine why it wouldn't, but I know <?php= works with short-tags enabled. At least with PHP5+.
I'm not running a site with short-tags disabled or with PHP4, so I'm unable to verify this.

I like me some short tags though...

Ben

Re: PHP Parse error: syntax error, unexpected '='

Posted: Fri Mar 07, 2008 12:06 am
by Chris Corbyn
<?= is a short tag. "<?php echo" is the proper version ;)