I am displaying few values in the table from the database, the while loop works properly anywhere outside the table, but inside the table it is displaying nothing. I have added the entire code as advised, I have provided the sql queries which I used and also the entire HTML Form. I have tried all the code changes and nothing helps.
<!doctype html>
<?php
include ("connect.php");
session_start();
$getid=mysqli_real_escape_string($db,$_GET['key']);
$username=$_SESSION['login_user'];
unset($_SESSION['getid']);
$_SESSION['getid']=$getid;
$userinfo="select * from users_master where username='$username'";
$result=mysqli_query($db, $userinfo);
$task = "select * from task_master where id='$getid'";
$result1=mysqli_query($db, $task);
$task_assigned_to="select * from task_assigned_to where id='$getid'";
$result2=mysqli_query($db, $task_assigned_to);
$task_follow="select * from task_followers where id='$getid'";
$result3=mysqli_query($db, $task_follow);
?>
<html>
<head>
<meta charset="utf-8">
<title>Task Info</title>
<link rel="stylesheet" href="style/style.css">
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="fontawesome/css/all.css">
<script type="text/javascript">
function myFunction() {
var left = (screen.width/2)-(450/2);
var top = (screen.height/2)-(450/2);
let params = `scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,
width=800,height=300,left=`+top+`,top=`+top;
window.open('closurepopup.html','test',params);
}
</script>
</head>
<body>
<form name="followupform" action="controllers.php" method="POST">
<input type="hidden" name="taskfollowupid" value="<?php echo $getid; ?>"
<div class="title1">
<a href="closurepopup.html"><button type="button" name="btnclosetask" class="btn btn-primary">Complete</button></a>
<a href="extenddeadline.php?key=<?php echo $getid; ?>"><button type="button" name="btnextenddeadline" class="btn btn-info">Extend deadline</button></a>
<a href="edittask.php?key=<?php echo $getid; ?>"><button type="button" name="btnedittask" class="btn btn-info">Edit Task</button></a>
</div>
<br>
<div>
<?php while ($row=mysqli_fetch_array($result1,MYSQLI_ASSOC))
{
?>
<i class="fa fa-star fa-2x" aria-hidden="true"><?php echo "#". $row['id']." " .$row['tasktitle']; ?></i>
<?php } ?>
</div>
<br>
<table class="table table-bordered">
<tr>
<th>Task Assigned by</th>
<td><?php
while ($row=mysqli_fetch_array($result, MYSQLI_ASSOC))
{
echo $row['first_name']. " " .$row['last_name']; }?></td>
</tr>
<?php
while ($row1=mysqli_fetch_array($result1))
{
echo print_r($row) & print_r($row2);
?>
<tr>
<th>Status</th>
<td><?php echo $row1['status']; ?></td>
</tr>
<tr>
<th>Description</th>
<td><?php echo $row1['description']; ?></td>
</tr>
<tr>
<th>Deadline</th>
<td><?php echo $row1['deadline']; } ?></td>
</tr>
<tr><th>Task Assigned to</th>
<td>
<?php
while($row2=mysqli_fetch_array($result2,MYSQLI_ASSOC))
{
echo $row2['first_name']." ".$row2['last_name'].'; ';
}
?>
</td></tr>
</table>
<table class="table table-bordered">
<tr>
<th>Followed By</th>
<td>
<?php
while($row3=mysqli_fetch_array($result3, MYSQLI_ASSOC))
{
echo $row3['first_name']. " " .$row3['last_name'].'; ';
}
?>
</td>
</tr>
</table>
<textarea rows="2" cols="80" name="followupmess" placeholder="Followup message"></textarea><br>
<button type="submit" name="btnsendfollowup" class="small">Send Followup</button><br>
</form>
<?php
$followup = "select * from followup_messages where id='$getid'";
$result3=mysqli_query($db,$followup);
while ($row3=mysqli_fetch_array($result3))
{
?>
<table class="table table-bordered">
<tr>
<th>Sent by</th>
<td><?php echo $row3['first_name']. " " .$row3['last_name']; ?></td>
</tr>
<tr>
<th>Sent on</th>
<td><?php echo $row3['created_at']; ?></td>
</tr>
<tr>
<th>Message</th>
<td><?php echo $row3['message']; ?></td>
</tr>
</table>
<?php
}
?>