I have a query that returns this in a browser:
------------------------------
For Frozen/Totes (id # 7)
Job 30 needs 2 people
Job 32 needs 1 people
For Single Pass/Reg Box (id # 6)
Job 32 needs 1 people
Job 33 needs 3 people
Job 34 needs 1 people
------------------------------
What I need is some code that will keep track of the different jobs and how many people are needed for a job. For example:
Job 30 totals 2 people (2 from Frozen/Totes)
Job 32 totals 2 people (1 from Frozen/Totes-1 from Single Pass/Reg)
and so on...
The code I have now that returns the above information is this:
foreach ($id as $value) {
$query_name = "select * from process where proid = $value";
$result_name = mysql_query($query_name);
$row_name = mysql_fetch_array($result_name);
$processname = $row_name['proname'];
echo "<b>For $processname (id # $value)</b><br>";
$query = "select jb.jobid , jb.jobname, pj.pjproid, pj.pjjobid, pj.pjnumber from jobs jb left outer join process_jobs pj on jb.jobid = pj.pjjobid where pj.pjproid = $value order by jb.jobname asc";
$result = mysql_query($query);
$num = mysql_num_rows($result);
for ($i=0; $i<$num; $i++) {
$row = mysql_fetch_array($result);
$pjjobid = $row['pjjobid'];
$pjnumber = $row['pjnumber'];
echo "Job $pjjobid needs $pjnumber people<br>";
}
echo "<p>";
}
----------------------------------
Anyone have any thoughts, I'm out of ideas, thanks!
-Cy