I have a table employee in database. I was able to add, fetch and display each row in that table in an html table dynamically using php.
<a href='add-employee.php' style='float:right;'>Add Employee</a>
<table class="table table-responsive">
<thead>
<th><strong>Employee Id</strong></th>
<th><strong>Last Name</strong></th>
<th><strong>First Name</strong></th>
<th><strong>Department</strong></th>
<th><strong>Position</strong></th>
<th><strong>Telephone</strong></th>
</thead>
<tbody>
<?php
$load_employees = mysql_query("SELECT * FROM tbl_employee");
$loaded_employees = mysql_num_rows($load_employees);
while($y=mysql_fetch_array($load_employees)){
$emp_id = $y['emp_id'];
$last = $y['emp_lname'];
$first = $y['emp_fname'];
$department = $y['emp_department'];
$position = $y['emp_pos'];
$tel = $y['emp_tel'];
echo "<tr>
<td>$emp_id</td>
<td>$last</td>
<td>$first</td>
<td>$department</td>
<td>$position</td>
<td>$tel</td>
</tr>";
}
?>
</tbody
My problem is that wasn't able to update a specified row in the html table. What I would like to happen is let's say for example there is already 5 entries in that table which means 5 rows, when a user clicks on a certain row , it would pass the emp_id which is the primary key for each row and redirect to update-emp.php page which contains a form for updating the row.