PHP Notice: Undefined variable: nomor in C:\xampp\htdocs\test\tabel.php on line 19 -


i learning php, , found error in first lesson, had few hours try not know solution.

<td><?php echo $nomor=$nomor+1; ?></td>

my php code:

<?php include "koneksi.php"; $query=mysql_query("select * biodata"); $jumlah=mysql_num_rows($query); echo "jumlah data ada : ".$jumlah; ?> <table border="1"> <tr> <th>nomor</th><th>nama</th><th>alamat</th><th>usia</th><th>aksi</th> </tr> <?php while($row=mysql_fetch_array($query)){ ?> <tr> <td><?php echo $nomor=$nomor+1; ?></td>  <td><?php echo $row['nama']; ?></td>  <td><?php echo $row['alamat']; ?></td> <td><?php echo $row['usia']; ?></td> <td> <a href="delete.php?id=<?php echo $row['id']; ?>" onclick="return confirm('apakah anda yakin?')">delete</a> <a href="update.php?id=<?php echo $row['id']; ?>">update</a> </td> <?php } ?> </table><br />  <a href="form.php">input data form</a> 

thanks before

you haven't initialize $nomor variable so, php interpreter, doesn't know $nomor first time "read" it

modify code way

<?php   $nomor=0;   while($row=mysql_fetch_array($query)){ ?> 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -