Welcome Guest, Not a member yet? Register   Sign In
How do I re-use query results?
#5

[eluser]CJL01[/eluser]
[quote author="TheFuzzy0ne" date="1243203752"]Please can you post the code in those three methods, where you need to re-use the result?[/quote]

Here's the table generation function. I can provide the graph one too, but I think the problem must be here, because the $query is empty by the time we even get to the graph function...

Code:
function generate($query)
    {
        $table = "<table><tr>";
        $fields = $query->field_data();

        //header
        foreach ($fields as $field)
        {
            $fieldtitle = ucwords(strtolower(str_replace("_", " ", $field->name)));
            $table .= '<th align="center">'.$fieldtitle.'</th>';
        }
        $table .= "</tr>";

        //data
        foreach ($query->result_array() as $row)
        {
            $table .= "<tr>";
            foreach ($fields as $field)
            {
                $format = $this->get_format($field->name);
                $table .= "<td";
                if (@$format['style'] != '')
                    $table .= ' style="'.$format['style'].'"';
                if (@$format['align'] != '')
                    $table .= ' align="'.$format['align'].'"';
                $table .= ">";
            if (@$format['link'] != '') {
                if ($field->name == 'Date') $table .= '<a >name])).'">';
                else $table .= '<a >name]).'">';                
            }
            $table .= $row[$field->name];
        if (@$format['link'] != '')
            $table .= '</a>';
        $table .= "</td>";
    }
$table .= "</tr>";
}


Messages In This Thread
How do I re-use query results? - by El Forum - 05-24-2009, 10:54 AM
How do I re-use query results? - by El Forum - 05-24-2009, 11:06 AM
How do I re-use query results? - by El Forum - 05-24-2009, 11:22 AM
How do I re-use query results? - by El Forum - 05-24-2009, 11:23 AM
How do I re-use query results? - by El Forum - 05-24-2009, 11:26 AM
How do I re-use query results? - by El Forum - 05-24-2009, 11:28 AM
How do I re-use query results? - by El Forum - 05-24-2009, 12:00 PM
How do I re-use query results? - by El Forum - 05-24-2009, 02:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB