Welcome Guest, Not a member yet? Register   Sign In
need to display data from three tables
#2

[eluser]WanWizard[/eluser]
Query them in one select, joining goal to objective to step, other by goals.id, objectives.id, steps.id.

Then fetch the result into an array, and process it through a foreach:
Code:
$goal = $objective = NULL;
foreach ( $result as $row )
{
    if ( $goal != $row['goal_id'] )
    {
        // new goal, do something here
        $goal = $row['goal_id'];
    }

    if ( $objective != $row['objective_id'] )
    {
        // new objective, do something here
        $objective = $row['objective_id'];
    }

    // do something with the step
}


Messages In This Thread
need to display data from three tables - by El Forum - 11-23-2010, 03:45 PM
need to display data from three tables - by El Forum - 11-23-2010, 04:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB