Question
I would like to get value of a table data on button click. I have 2 tables inner join advance and employee, On employee.php I
I would like to get value of a table data on button click. I have 2 tables inner join advance and employee, On employee.php I have a table showing all records of all employee and the VIEW button which when clicked it should open the advance.php page and get all the data from the single record selected based on the employee_id.
if(isset($_POST["view_id"]))
$id = ($_POST["view_id"]);
$connect = mysqli_connect("localhost", "root", "", "project08");
$query = "SELECT emp.employee_id, emp.firstname, emp.lastname, ad.amount, ad.date_advance from advance AS ad INNER JOIN employees AS emp where ad.employee_id = emp.id AND ad.employee_id = '$id'"; // here if I change $id by the id of the table advance employee_id = 30, it will display the data of this single values.
$result = mysqli_query($connect, $query);
while($row = mysqli_fetch_array($result))
{
echo "
Name
".$row['employee_id']."
Address
".$row['firstname']."
";
}
?>
Showing rows 0 - 2 (3 total, Query took 0.0042 seconds.) SELECT emp. employee_id, emp.firstname, emp.lastname, ad. amount, ad.date_advance from advance AS ad INNER JOIN employees AS emp where ad. employee_id = emp.id AND ad. employee_id 30 Profiling [Edit inline][ Edit ] [ Explain SQL] Show all Number of rows: 25 Filter rows: Search this table Sort by key: None + Options employee_id ITX743089152 firstname lastname amount date_advance 2021-01-06 1000 ITX743089152 1000 2021-01-06 ITX743089152 5 2021-01-06Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started