blasterstudios
Technical User
ok. i need to setup a query that pulls all jobs for a specific user. the only thing is the user's name can appear in 2 different columns. 1 for when they created a job, and the other when someone created a job for them. I need it to check both columns and pull the ones where they are involved. the query i have just repeats only the first one for however many they have. for instance if there are 4 jobs that involve id "2", it lists the first job 4 times. here's what i got:
Code:
$query_getuserjobs = "SELECT
fox_clients.code AS code,
fox_jobs.jobid AS jobid,
fox_clients.name AS client,
fox_users_employee.firstname AS employee,
fox_users_originator.firstname AS originator,
fox_jobs.duedate,
fox_status.status AS status,
fox_priorities.prioritylevel AS priority,
fox_types.type AS jobtype
FROM
fox_jobs,
fox_clients,
fox_users AS fox_users_employee,
fox_users AS fox_users_originator,
fox_status,
fox_priorities,
fox_types
WHERE
fox_clients.clientid = fox_jobs.client AND
fox_users_employee.userid = fox_jobs.employee AND
fox_users_originator.userid = fox_jobs.originator AND
(fox_jobs.employee = " . $_GET['user'] . " OR fox_jobs.originator = " . $_GET['user'] . ") AND
fox_status.statusid = fox_jobs.status AND
fox_priorities.priorityid = fox_jobs.priority AND
fox_types.typeid = fox_jobs.jobtype AND
fox_jobs.status <= 2
ORDER BY fox_jobs.duedate ASC, fox_jobs.priority DESC";