php - How to fix unexpected $end error? -
hello iam learning create portal news using php, followed step step on book tutorial.but give me return error :(
iam check again , again syntax line line , code equal tutorial in books. think can not found error. grateful if me..
<link rel="stylesheet" type="text/css" href="style.css"/> <?php include 'koneksi.php'; $table1=berita; $table2=kategori; $id=1; $hal = $_get[hal]; if(!isset($_get['hal'])){ $page = 1; }else { $page = $_get['hal']; } $max_result = 2; echo $page; $from = (($page * $max_result) - $max_result); $sql=mysql_query("select * $table1, $table2 $table1.id_kategori , $table1.id_kategori=$table2.id_kategori order tanggal desc limit $from, $max_result;"); while($tampil=mysql_fetch_array($sql)){ $data=substr($tampil['isi'],0,200); ?> <div class="box"> <p align="justify"> <img src="<?=$tampil[gambar];?>" align="left"> <font valign="top"> <strong><?php echo $tampil[judul]; ?></strong>" <?php echo $data;?> <a href="index.php?menu=detail_politik&id=<?=$tampil['id_berita'];?>">baca selengkapnya-->>>></a> </font></p></div><br> <?php } $total_results = mysql_result(mysql_query("select count(*) num $table1 $table1.id_kategori=$id"),0); $total_pages = ceil($total_results/$max_result); echo "<center>pilih halaman<br/>"; if($hal > 1){ $prev = ($page - 1); echo "<a href=$_server[php_self]?menu=politik&hal=$prev><-sebelumnya</a>"; } for($i = 1; $i <=$total_pages; $i++){ if(($hal) == $i){ echo "$i"; }else{ echo "<a href=$_server[php_self]?menu=politik&hal=$i>$i</a>"; } if($hal < $total_pages){ $next = ($page + 1); echo "<a href=$_server[php_self]?menu=politik&hal=$next>selanjutnya-></a>"; } echo "</center>" ?>
this code give me error : parse error: syntax error, unexpected $end in c:\appserv\www\beritaonline\filepolitik.php on line 48
and line on 48 : last line of code, ?>
whats wrong dear :'((
you need add semicolon ;
after last echo
:
echo "</center>"; ?>
in cases, won't need closing php tags ?>
either.
also, for
loop has no closing }
:
for($i = 1; $i <=$total_pages; $i++){
this throw error.
Comments
Post a Comment