I’ve got data being returned by a database search (using php) that I want to automatically format into a table (or something similar). Current output is this:
Item: 15675
Image = e:\woodward\woodward_9450006884.tif
Account = 3030803
Invoice = 405632
Item: 21711
Image = e:\woodward\woodward_9460005712.tif
Account = 3006036
Invoice = 425632
Item: 39762
Image = e:\woodward\woodward_9490002689.tif
Account = 580002
Invoice = 445632
This is the php code that creates the output:
// dumpResults of a select statement
public function dumpResults($rest) {
$response = “”;
if ($rest) {
foreach ($rest as $item) { // split up items
$response .= “Item: “.$item[“Name”].””;
foreach ($item[“Attributes”] as $attribute => $value) { // split up attributes
if (is_array($value)) {
foreach($value as $onevalue) { // if array of values
$response .= ” $attribute = $onevalue”;
}
} else { // if single value
$response .= ” $attribute = $value”;
}
}
$response .= “”;
}
} else {
$response = “”;
}
return $response;
}
/**
* Clear public parameters
*
*/
You may have guessed I’m not good at this stuff! Any pointers as to what I should be looking at to get a better result?