0

tampil_produk.php

<?php
include "includes/koneksi.php";

echo "<table>";
  $sql=mysql_query("select * from produk order by id_produk desc");

  while ($r=mysql_fetch_array($sql)){
    $harga     = number_format($r[harga],0,",",".");
    $deskripsi = nl2br($r[deskripsi]); // membuat paragraf 
    $isi       = substr($deskripsi,0,220); // ambil sebanyak 220 karakter
    $isi       = substr($deskripsi,0,strrpos($isi," ")); // potong per spasi kalimat

    echo "<tr><td><img src='foto_produk/small_$r[gambar]' align=left hspace=20 border=0></td><td><b>$r[nama_produk]</b> <br /><br />
          $isi ... <a href=#>Selengkapnya</a></td></tr>
          <tr><td>Rp. <b>$harga</b> </td><td><a href=aksi.php?module=keranjang&act=tambah&id=$r[id_produk]><img src='images/beli.jpg' border=0></a></td></tr>
          <tr><td colspan=2><hr /></td></tr>";
  }
echo "</table>";
?>

Notice: Use of undefined constant harga - assumed 'harga' in C:\xampp\htdocs\php_template2\tampil_produk.php on line 8

Notice: Use of undefined constant deskripsi - assumed 'deskripsi' in C:\xampp\htdocs\php_template2\tampil_produk.php on line 9

Why does the error appears?

Thanks before.

2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by pzuurveen
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.