html/php help - aut...
 

  You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more

[Closed] html/php help - automatically converting data to a table. Possible?

2 Posts
2 Users
0 Reactions
84 Views
Posts: 13916
Free Member
Topic starter
 

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?


 
Posted : 29/01/2014 2:00 pm
Posts: 0
Free Member
 

12


 
Posted : 29/01/2014 2:04 pm
Posts: 13916
Free Member
Topic starter
 

Actually that php code is no help is it!! Anyway I'm guessing that I should address my issue by tackling the php code that is creating the output - so I'm going to have a go at that before I try something else.


 
Posted : 29/01/2014 2:38 pm

6 DAYS LEFT
We are currently at 95% of our target!