I have some code that allows me to produce a graph and table of data, it would appear that my code only gives the first result whereas i want all the results any help please?! I need the taskcode, taskname and tu from the user_tasks table where the custid = $username and buildingid=$buildingid.
Some of the code is below:
foreach ($areaSum as $thisID) {
$dispID = $thisID;
if (substr ($dispID, 1, 1) == 0)
$dispID = substr ($dispID, 0, 1) . substr ($dispID, 2, 1);
$typesSQL = "SELECT * FROM user_tasks WHERE custid LIKE '$username' AND buildid LIKE '$buildingid' AND fvalue > 0 AND taskcode <> ''";
$typesResults = mysql_query ($typesSQL);
$typesRow = mysql_fetch_assoc ($typesResults);
$assoc[$dispID] = $typesRow["tu"];
$types[$dispID] = $typesRow["taskname"];
}
$compSQL = "SELECT * FROM signup WHERE uname ='$username'";
$compResult = mysql_query ($compSQL);
$compRow = mysql_fetch_assoc ($compResult);
$compName = $compRow["compname"];
$recordSQL = "SELECT * FROM user_buildings WHERE buildingid='$buildingid' AND userid='$username'";
$recordResults = mysql_query ($recordSQL);
$recordRow = mysql_fetch_assoc ($recordResults);
$buildingname = $recordRow["buildingname"];
$labels = array_keys ($assoc);
$values = array_values ($assoc);
$pdf->barChart (10,70,820,450, $labels, $values);
$pdf->Image ("images/barbanner.jpg", 15,200);
$pdf->SetFont ('Courier', '', 20);
$pdf->SetXY (20,20);
$pdf->Cell (0, 10, "Company: $compName", 0, 0, 2);
$pdf->SetXY (20,40);
$pdf->Cell (0, 10, "Building Name: $buildingname");
$pdf->AddPage();
$pdf->SetFont ('Courier', '', 14);
$pdf->Cell (80,12, "Graph data:", 0, 1);
$pdf->SetXY (50, 60);
$pdf->SetFont ('Courier', '', 12);
$pdf->Cell (80,20, "Task Code", 1, 0, 'C');
$pdf->Cell (450,20, "Task Description", 1, 0, 'C');
$pdf->Cell (250,20, "Time Units", 1, 1, 'C');
foreach ($areaSum as $thisID) {
$dispID = $thisID;
if (substr ($dispID, 1, 1) == 0)
$dispID = substr ($dispID, 0, 1) . substr ($dispID, 2, 1);
$pdf->SetX (50);
$pdf->Cell (80,15, $dispID, 1, 0, 'C');
$pdf->Cell (450,15, " ". $types[$dispID], 1, 0);
$pdf->Cell (250,15, $assoc[$dispID], 1, 1, 'C');
}
$pdf->Output();