Viewing 3 posts - 1 through 3 (of 3 total)
  • html/php help – automatically converting data to a table. Possible?
  • sharkbait
    Free Member

    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?

    seosamh77
    Free Member

    12

    sharkbait
    Free Member

    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.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘html/php help – automatically converting data to a table. Possible?’ is closed to new replies.