Hello there i am having little problem. I have two tables in my database.

As you can see i am getting all employees in one tab, and what i am trying to achieve here is to display only relevant employees in given tab. So employees from Customer services wont be displayed in Sales tab for example.
$query = mysql_query("SELECT * "."FROM employees, dept_emp "."WHERE employees.emp_no = dept_emp.emp_no");
Thank you for looking and help 🙂
Your WHERE clause is useless as it is just restating a JOIN condition basically. Try this:
Obviously the
?would be substituted with thedept_novalue you are actually trying to filter on.Per your question about seeting query limits/pagination, that is done via SQL
LIMITclause. The clause can be expressed in a few different ways.This first just returns a max number of rows:
The following two forms of syntax are used for pagination of results:
Or:
So putting it all together
Note that I also added an
ORDER BYclause. This is important for pagination in that just a regular unorderedSELECTdoesn’t guarantee order. If you tried to paginate without anORDER BYyou could potentially get the same row returned in multiple “pages”.