Run SQL qurey from link

Hello people

I have table for company, in emplyeey.php it will list all the employees in the table. I want to make link so anyone clicked it will show employees in a department

for example employee.php?projects, if one clicked it it will show employees in the projects department
employee.php?management, if one clicked it it will show employees in the management department

Is that possible?

yep, you almost have it, the link would be something like

employee.php?dept=management

Then in the query, you’d do something

$qry = mysql_query(“SELECT * FROM employees WHERE dept =”’.mysql_real_escape_string($_POST[‘dept’].’") or die(mysql_error());

Why not just group the employees by their department when you display them? save yourself the extra coding.

Thanks richei

Sponsor our Newsletter | Privacy Policy | Terms of Service