<?php
SESSION_START();
require 'config.php';
$query="SELECT * FROM topics WHERE student_id='".$_SESSION['id']."' AND id='".$_GET['id']."';";
$result=mysql_query($query) or die(mysql_error());
$rows=mysql_fetch_assoc($result);
?>
<table>
<tr>
<td colspan="2"><?php echo $_SESSION['user_name']; ?></td>
<td colspan="8"><b><?php echo $rows['title']; ?></b></td>
</tr>
<tr>
<td colspan="2"></td>
<td colspan="8"><?php echo $rows['description']; ?></td>
</tr>
<?php $sql="SELECT * FROM comments WHERE topic_id='".$_GET['id']."';";
$comment_result=mysql_query($query) or die(mysql_error());
While($row=mysql_fetch_assoc($comment_result))
{
?>
<tr>
<td colspan="2">
<?php $t_query="SELECT * FROM users WHERE id='".$row['teacher_id']."';";
$result=mysql_query($t_query) or die(mysql_error());
$trow=mysql_fetch_assoc($result);
echo $trow['user_name'];
?>
</td>
<td colspan="8"><?php echo $row['comment']; ?></td>
</tr>
<?php
}
?>
</table>
I am having this code.
It is giving error
Notice:Undefined index: teacher_id in /opt/lampp/htdocs/register/viewtopic.php on line 24
Notice: Undefined index: comment in /opt/lampp/htdocs/register/viewtopic.php on line 30