Reputation: 155
I have that code included to the main.php and received syntax error “unexpected $end” at last line of this code even I put the } for the while loop. Please help
<?php
while($row=mysql_fetch_array($rs))
{
?>
<div class="center_title_bar"><?php echo $row['ProName']?></div>
<div class="prod_box_big">
<div class="top_prod_box_big"></div>
<div class="center_prod_box_big">
<?php
echo"<div class='product_img_big'>";
echo"<a href='javascript:popImage('".$row['ProPicture']."','".$row['ProName']."') title='".$row['ProName']."'><img src='".$row['ProPicture']."' alt='' border='0' /></a>";
echo"</div>";
echo"<div class='details_big_box'>";
echo"<div class='product_title_big'>'".$row['ProName']."'</div>";
echo"<div class='specifications'>'".$row['ProInfo']."'<br />";
echo"Trạng thái: <span class='blue'>";
if($row['ProQuantity'])
{
echo"Còn hàng";
}
else {
echo"Hết hàng";
}
echo"</span><br />";
echo"Bảo hành: <span class='blue'>".$row[ProWarranty]." tháng</span><br />";
echo"</div>";
echo"<div class='prod_price_big'><span class='price'>".number_format($row['ProPrice'],0,',','.')." VND</span></div>";
echo'<a href="?options=giohang&action=add&item='.$row[ProID].'" class="addtocart">Thêm vào giỏ</a>';
?>
<a href="location:history.back()" class='compare'>Quay lại</a>
</div>
</div>
</div>
<div class="bottom_prod_box_big"></div>
}
Parse error: syntax error, unexpected $end in
Upvotes: 0
Views: 332
Reputation: 258
this is the script without error
while ($row = mysql_fetch_array($rs)) {
?>
<div class="center_title_bar"><?php echo $row['ProName'] ?></div>
<div class="prod_box_big">
<div class="top_prod_box_big"></div>
<div class="center_prod_box_big">
<?php
echo"<div class='product_img_big'>";
echo"<a href='javascript:popImage('" . $row['ProPicture'] . "','" . $row['ProName'] . "') title='" . $row['ProName'] . "'><img src='" . $row['ProPicture'] . "' alt='' border='0' /></a>";
echo"</div>";
echo"<div class='details_big_box'>";
echo"<div class='product_title_big'>'" . $row['ProName'] . "'</div>";
echo"<div class='specifications'>'" . $row['ProInfo'] . "'<br />";
echo"Trạng thái: <span class='blue'>";
if ($row['ProQuantity']) {
echo"Còn hàng";
} else {
echo"Hết hàng";
}
echo"</span><br />";
echo"Bảo hành: <span class='blue'>" . $row[ProWarranty] . " tháng</span><br />";
echo"</div>";
echo"<div class='prod_price_big'><span class='price'>" . number_format($row['ProPrice'], 0, ',', '.') . " VND</span></div>";
echo'<a href="?options=giohang&action=add&item=' . $row[ProID] . '" class="addtocart">Thêm vào giỏ</a>';
?>
<a href="location:history.back()" class='compare'>Quay lại</a>
</div>
</div>
</div>
<div class="bottom_prod_box_big"></div>
<?php
}
Upvotes: 0
Reputation: 1042
If this is the whole script, you forgot to close the while
loop from the begining, at the end of the file.
You need to add:
<?php } ?>
at the end of the file.
Upvotes: 5