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?

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']."'>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.