0

Undefined variable: no in C:\xampp\htdocs\war\cPanel\pollingTampil.php on line 28

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Daftar Polling</title>
</head>

<body>
<table width="702" border="0" cellspacing="1" cellpadding="2">
  <tr>
    <td width="58">no</td>
    <td width="232">pertanyaan</td>
    <td width="122">op1</td>
    <td width="104">op2</td>
    <td width="96">op3</td>
    <td width="59">&nbsp;</td>
  </tr>
  
   <?php 
   include "inc.session.php" ;
include 'C:\xampp\htdocs\war\librari\inc.koneksi.php' ;
  
  $sqlTampil = "SELECT * FROM polling ORDER BY id";
  $qryTampil = mysql_query($sqlTampil, $koneksi) 
  			   or die ("Gagal query".mysql_error());
			   
  while($dataTampil=mysql_fetch_array($qryTampil)) {
  $no ++; 
  ?>
  
  <tr bgcolor="#FFFFFF">
   <td> <?php echo $no; ?> </td>
    <td> <?php echo $dataTampil['pertanyaan']; ?> </td>
    <td> <?php echo $dataTampil['hasil1']; ?> </td>
    <td> <?php echo $dataTampil['hasil2']; ?> </td>
    <td> <?php echo $dataTampil['hasil3']; ?> </td>
    <td>  </td>
  </tr>
  <?php } ?>
</table>

<p align="left"><table border="0" cellspacing="1"
width="ancho"><tr>

<td width="ancho"><form method="link"
action="pollingNew.php"  > <p> <input type="submit"
value="INPUT"
name="1"></form></td>

<td width="ancho"><form method="post"
action="pollingeditTampil.php" ><p><input type="submit" value="EDIT"
name="2"></form></td>

</tr></table>

</body>
</html>

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by ko ko
0

You have not already defined the variable '$no'. Define this variable outside of the loop before starting the loop. Like below.

$no=0;
while($dataTampil=mysql_fetch_array($qryTampil)) {
  $no++; 
  ?>
  
  <tr bgcolor="#FFFFFF">
   <td> <?php echo $no; ?> </td>
    <td> <?php echo $dataTampil['pertanyaan']; ?> </td>
    <td> <?php echo $dataTampil['hasil1']; ?> </td>
    <td> <?php echo $dataTampil['hasil2']; ?> </td>
    <td> <?php echo $dataTampil['hasil3']; ?> </td>
    <td>  </td>
  </tr>
  <?php } ?>
This topic has been dead for over six months. 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.