OCIFetchStatement from joined tables

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Vishant

    OCIFetchStatement from joined tables

    Hi,

    I'm having a problem getting the values from an OCIFetchStateme nt.

    Using the following codes, I'm geting the results from two table
    joined and I have to print out the results in such a way that I get
    my first row from table A and then the results of the table B which
    have the same key just below row of table A. and this goes on.


    The values are replaced into a template before being displayed:

    $nb_rt = OCIFetchStateme nt($stmt,$resul ts);
    for ( $i = 0; $i < $nb_rt; $i++ )
    {
    if ($i < $MAX_ROWS_DISPL AYED)
    {
    reset($results) ;
    $index_rt++;
    if (($i == 9) || ($i == $nb_rt-1))
    $un_rt_modif_ht m = $un_rt_last_htm ;
    else
    $un_rt_modif_ht m = $un_rt_htm;


    $j = 0;
    $id_rt = "";
    $index = "";
    while ( $column = each($results) ) {
    $j++;
    $data = $column['value'];
    if ($j == 1)
    $id_rt = $data[$i];
    else if ($j == 2)
    $index = $id_rt."_".str_ replace(" ", "", $data[$i]);

    $champ_rt[$j] = "#" . $column['key'] . "#";
    $un_rt_modif_ht m = replace_champs( $champ_rt[$j], $data[$i],
    $un_rt_modif_ht m);
    }
    }

    I'm trying to put the results of table B into a second array called
    resultsB, since it is in the select statement as from the 12th column,
    which defined as:

    for($abc=0; $abc < 12; $abc++)
    {
    $resultsB[$abc] = $results[$abc+11];
    }

    The problem is that I'm not geting the values in the resultsB using
    the following:

    $j = 0;
    $index = "";
    while ( $column = each($resultsB) ) {
    $j++;
    $data = $column['value'];
    if ($j == 1)
    $index = $data[$x];
    else if (($j > 1) && ($j <= 6))
    $index .= "_".str_replace (" ", "", $data[$x]);
    else if($j == 7) {
    if($data[$x] == "Réémis") {
    $index .= "_r";
    }
    else {
    $index .= "_n";
    }
    }
    }


    I really don't know why it's not getting the values from resultsB.

    Any suggestions please.

    Thanks.
Working...