php - i do not seem to understand why im having these undefined index notices -


what causing undefined index error or notices im getting on page

notice: undefined index: start_date in c:\xampp\htdocs\how things\admin panel\daily.php on line 97  notice: undefined index: balance in c:\xampp\htdocs\how things\admin panel\daily.php on line 98   

the code on line 97 , 98 is

echo '<td>' . $row['start_date'] . '</td>'; echo '<td>' . $row['balance'] . '</td>'; 

this whole code

<?php  include'includes/connect.php';  $allowedsorts = array('start_date', 'balance');      $sort = isset($_get['sort']) ? $_get['sort'] : '';     $result = "select date_format(start_date, '%m-%d') 'month , day',balance amount `aggrement`";     if(in_array($sort, $allowedsorts)){          $result .= " order {$sort}";     }      $result = mysql_query($result) or die(mysql_error());   echo "<table border='1' cellpadding='10'>"; echo "<tr> <th><a href='view.php?sort=start_date'>month , day</th> <th><a href='view.php?sort=balance'>amount paid</th> </tr>";  while($row = mysql_fetch_array( $result )) {  echo "<tr>"; echo '<td>' . $row['start_date'] . '</td>'; echo '<td>' . $row['balance'] . '</td>'; echo "</tr>";  }  echo "</table>"; ?> 

thanks in advance

you're setting alias name each one, can't access them default columnname.

you must them alias name.

$row["month , day"] , $row["amount"].


Comments