I am learning PHP and stuck at a point where I want to extract one row (data for one person with his ID, Image, name, age, address etc) from the table individually and display it in a separate webpage for each user upon clicking View button. I have tried different solutions but failed. Please help.
Following is my table code from where I need to extract data for individual person:
<?php
include("connection.php");
error_reporting(0);
$query = "SELECT * FROM users";
$data = mysqli_query($conn, $query);
$total = mysqli_num_rows($data);
if($total != 0)
{
?>
<h1 align="center">Consultation Console</h1>
<table border="2" cellspacing="2" width="100%" cellpadding="3px">
<tr>
<th width="2%">ID</th>
<th width="10%">Reports</th>
<th width="10%">Full Name</th>
<th width="6%">D.O.B</th>
<th width="2%">Gender</th>
<th width="2%">Marital Status</th>
<th width="1%">CNIC</th>
<th width="8%">Address</th>
<th width="3%">Phone</th>
<th width="12%">Complaint</th>
<th width="8%">History</th>
<th width="5%">Operations</th>
</tr>
<?php
while($result = mysqli_fetch_assoc($data))
echo "<tr>
<td>".$result[id]."</td>
<td> <img src= '".$result[ptreports]."' height='50px' width='50px'> </td>
<td>".$result[fullname]."</td>
<td>".$result[bday]."</td>
<td>".$result[gender]."</td>
<td>".$result[marital]."</td>
<td>".$result[cnic]."</td>
<td>".$result[address]."</td>
<td>".$result[phone]."</td>
<td>".$result[complaint]."</td>
<td>".$result[history]."</td>
<td><a href='newdisplay.php?id=$result[id]'><input type='submit' value='View' class='update'><a/>
<td><a href='update.php?id=$result[id]'><input type='submit' value=' Update' class='update'><a/>
<a href='delete.php?id=$result[id]'><input type='submit' value='Delete' class='delete' onclick = 'return checkdelete()'><a/></td>
</tr>";
}
?>
</table>
<script>
function checkdelete()
{
return confirm('Are you sure you want to delete this record ?');
}
</script>