0

tampil_produk.php

//Langkah 2: Sesuaikan perintah SQL
echo "<table>";

  $tampil = "select * from produk order by id_produk desc LIMIT $posisi,$batas";
  $hasil  = mysql_query($tampil);
  $result=mysql_query("select * from produk order by id_produk desc LIMIT $posisi,$batas");
  $no = $posisi+1;
  
  while ($data=mysql_fetch_array($result)){
    $harga     = number_format($data['harga'],0,",",".");
    $deskripsi = nl2br($data['deskripsi']); // membuat paragraf 
    $isi       = substr($deskripsi,0,220); // ambil sebanyak 220 karakter
    $isi       = substr($deskripsi,0,strrpos($isi," ")); // potong per spasi kalimat

	$no++;
    echo "<tr><td><img src='foto_produk/small_$r[gambar]' align=left hspace=20 border=0></td><td><b>$data[nama_produk]</b> <br /><br />
          $isi ... <a href="./?id_produk='.$data['id_produk'].'&id_kategori='.$data['id_kategori'].'">Selengkapnya</a></td></tr>
          <tr><td>Rp. <b>$harga</b> </td>
		      <td><a href=contact_us.php><img src='images/beli.jpg' border=0></a></td></tr>
          <tr><td colspan=2><hr /></td></tr>";
  }
echo "</table>";

Parse error: syntax error, unexpected '/' in C:\xampp\htdocs\Masterlink\cgoods\tampil_produk.php on line 41

Line 41 is line 18 in the above code. Why is it? How to fix it?

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by smith32
0
echo "<a href="./?id_produk='.$data['id_produk'].'&id_kategori='.$data['id_kategori'].'">

It should be like this

echo "<a href='./?id_produk=".$data['id_produk']."& id_kategori=".$data['id_kategori']."'>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.