didgydont Posted October 30, 2012 Share Posted October 30, 2012 hi all I have two tables on a job board 1st table like so "custid,customer,duedate,statusid" the status is just an id wich refrences the second table 2nd table "statusid,stutus,hidden,completed" at the moment i have select * from jobs then if (!functiontocheckifcomplted($row[statusid])==true) { then display stuff here } but it still reads evey mysql job is there a better way to do this ? Quote Link to comment Share on other sites More sharing options...
Barand Posted October 30, 2012 Share Posted October 30, 2012 Do the completed check in the query SELECT custid, customer, duedate, statusid FROM table1 INNER JOIN table2 USING (statusid) WHERE table2.completed Quote Link to comment Share on other sites More sharing options...
didgydont Posted October 30, 2012 Author Share Posted October 30, 2012 Thank you what you suggested did not work for me but you pointed me in the right direction mysql_query("SELECT * FROM jobs INNER JOIN statuses ON jobs.status=statuses.id WHERE statuses.completed = '0' ORDER by jobs.duedate"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.