每行重复的结果

时间:2014-08-15 18:09:05

标签: php mysql

我运行一个查询,结果很好,但是在放入PHP结果时,每行重复一次,这里是代码:

$selectSi = 'SELECT * FROM series LEFT JOIN series_join on series.ids = series_join.id_sil GROUP BY series.ids';
$querySi = $connexion->query($selectSi);
$resultSi = $querySi->fetchAll();

$displaying = 5;
// building table here


foreach($resultSi as $siK=>$siV)
            {
                $ids = $siV['ids'];
                $silsila_en = $siV['silsila_en'];
                $id_shks = $siV['id_shks'];


    // get singer
    $sSel = 'SELECT shk_fname, shk_lname, shk_tran FROM shk_tbl WHERE id_shk = "'.$id_shks.'"'; 
    $sReq = $connexion->query($sSel);
    $sRes = $sReq->fetchAll();

    $listShk = '';

    foreach($sRes as $vS)
    {
        $shk_fname = $vS['shk_fname'];
        $shk_lname = $vS['shk_lname'];


        $shkFullName = $shk_fname.' '.$shk_lname;

        $shkFullNameLink = '<a href="">';
        $shkFullNameLink .= $shkFullName;
        $shkFullNameLink .= '</a> - ';

        $listShk .= $shkFullNameLink;

        $listSheikhs = substr($listShk, 0,-2).'<br />';

    }

// putting result into a table

echo '<tr class="multiColor">';
echo '<td>'.$silsila_en.'</td>';
echo '<td>'.$listSheikhs.'<br /></td>';

echo '</tr>';
            }
echo '</table>';

表格就像这样

PS:不是数字结果,而是歌手名字

serie table

serie_dup table

我正在寻找一个结果:

言语简洁:114 - 136
永恒的旅程:325 - 326 - 327
夜间母马:303 - 332 - 331 - 330 - 329 - 328 - 282 - 306 - 281 - 126 - 120

但是我得到了类似的东西:

言语简洁:114 - 136
永恒的旅程:114 - 136 - 325 - 326 - 327
夜间母马:114 - 136 - 325 - 326 - 327 - 303 - 332 - 331 - 330 - 329 - 328 - 282 - 306 - 281 - 126 - 120

所以第一行重复到第二行,第二行重复到第三行

提前致谢

0 个答案:

没有答案