从数据库中获取错误数据[关闭]

you can check my database class

when i call this methode

    public function getNote() {
            $epreuve = $this->_db->get('module', array('concour_code', '=', $this->data()->concour_code));
            $id = $this->data()->ID;
            foreach($epreuve->results() as $epreu){
                $epreu_code = $epreu->code;

                echo "<tr>";
                echo "<td>".$epreu->epreuve_code."</td><td>".$epreu->designation."</td>";
                $module = Database::getInstance()->query("SELECT note_condidat.note,note_condidat.condidat_concour_id,note_condidat.module_code
                                        FROM note_condidat,
                                        WHERE note_condidat.condidat_concour_id = {$id} AND note_condidat.module_code = {$epreu_code} "); 

                foreach($module->results() as $mod){
                    echo "<td>".$mod->note."</td>";
                }

                echo "</tr>";
            }
        }

Note : $this->data()->ID return user ID

i'm getting wrong data !! it take note from the module table not from note table

TablesResults table

solved :)

    public function getNote() {
            $epreuve = $this->_db->get('module', array('concour_code', '=', $this->data()->concour_code));
            $id = $this->data()->ID;
            foreach($epreuve->results() as $epreu){
                $epreu_code = $epreu->code;
                $note = Database::getInstance()->query("SELECT condidat_concour.ID,note_condidat.note,note_condidat.condidat_concour_id,note_condidat.module_code,module.code
                                                            FROM note_condidat,condidat_concour,module 
                                                            WHERE note_condidat.condidat_concour_id = '{$id}' AND note_condidat.module_code = '{$epreu_code}' ");
                echo "<tr>";
                echo  "<td>".$epreu->epreuve_code."</td>";
                echo  "<td>".$epreu->designation."</td>";
                echo "<td>";
                print_r($note->first()->note); echo "<b>/".$epreu->note."</b>";
                echo "</td>";
                echo  "<td>".$epreu->coef."</td>";
                echo "</tr>";
            }
        }