2016-09-14 5 views
-1

同じ表のすべての科目を取得するには、下のコードから変更する必要がありますか?同じ表内のすべての科目は私のシートマーク

<?php 
include('grade.php'); 
$mysubject = $grade->getsubject(); 
?> 
    <p>This is a template for a simple marketing or informational website.  It includes a large callout called a jumbotron and three supporting pieces of content. Use it as a starting point to create something more unique.</p> 
    <p><a class="btn btn-primary btn-lg" href="#" role="button">Learn more &raquo;</a></p> 
    </div> 
</div> 

<div class="container"> 
    <!-- Example row of columns --> 
    <div class="row"> 
    <?php foreach($mysubject as $row): ?> 
    <div class="col-lg-4 gradeform"> 
     <div class="form_hover " style="background-color: #428BCA;"> 
      <p style="text-align: center; margin-top: 20px;"> 
       <i class="fa fa-bar-chart-o" style="font-size: 147px;color:#fff;"></i> 
      </p> 

      <div class="header"> 
       <div class="blur"></div> 
       <div class="header-text"> 
        <div class="panel panel-success" style="height: 247px;"> 
         <div class="panel-heading"> 
          <h3 style="color: #428BCA;">Subject: <?php echo $row['subject'];?></h3> 
         </div> 
         <div class="panel-body"> 
          <table class="table table-bordered"> 
           <tr class="alert alert-danger"> 
            <th>TD</th> 
            <th>Exam</th> 
            <th>catching</th> 
            <th>average</th> 

           </tr> 
           <?php $mygrade = $grade- >getgrade($row['id']); ?>         
           <tr> 
            <td><?php echo $mygrade['att1']; ?></td> 
            <td><?php echo $mygrade['exam1']; ?></td> 
            <td><?php echo $mygrade['quiz1']; ?></td> 
            <td><?php echo $mygrade['project1']; ?></td> 
           </tr> 

          </table> 
          <div class="form-group"> 
           <?php $teacher = $grade->getteacher($row['id']); ?> 
           <label>Teacher: <?php echo $teacher;?></label><br /> 
           <label>Semester: <?php echo $row['sem']?> Sem</label><br /> 
          </div> 

         </div> 
        </div> 
       </div> 
      </div> 

     </div> 
    </div> 
    <?php endforeach; ?> 
    </div> 
+0

Uhmm ...何?私はあなたの質問をよく理解していません。 –

+0

私はすべての主題が異なる表にあります –

+0

'$ mysubject'の構造を示す必要があります。私たちはあなたが与えた限られた情報を手助けすることさえできません。 – nerdlyist

答えて

0

私はこの問題は、新しいテーブルを作成しているforeachループの各反復では、別のテーブルに

をすべての主題を持っています。あなたが一つのテーブルの下にすべての科目を表示したい場合は、ちょうどこのように、あなたのforeachループの<table>外を取る:

// your code 

<div class="container"> 
    <!-- Example row of columns --> 
    <div class="row"> 
    <div class="col-lg-4 gradeform"> 
     <div class="form_hover " style="background-color: #428BCA;"> 
      <p style="text-align: center; margin-top: 20px;"> 
       <i class="fa fa-bar-chart-o" style="font-size: 147px;color:#fff;"></i> 
      </p> 

      <div class="header"> 
       <div class="blur"></div> 
       <div class="header-text"> 
        <div class="panel panel-success" style="height: 247px;"> 
         <table class="table table-bordered"> 
          <?php foreach($mysubject as $row): ?> 
           <div class="panel-heading"> 
            <h3 style="color: #428BCA;">Subject: <?php echo $row['subject'];?></h3> 
           </div> 
           <div class="panel-body"> 
            <tr class="alert alert-danger"> 
             <th>TD</th> 
             <th>Exam</th> 
             <th>catching</th> 
             <th>average</th> 

            </tr> 
            <?php $mygrade = $grade- >getgrade($row['id']); ?>         
            <tr> 
             <td><?php echo $mygrade['att1']; ?></td> 
             <td><?php echo $mygrade['exam1']; ?></td> 
             <td><?php echo $mygrade['quiz1']; ?></td> 
             <td><?php echo $mygrade['project1']; ?></td> 
            </tr> 

            <div class="form-group"> 
             <?php $teacher = $grade->getteacher($row['id']); ?> 
             <label>Teacher: <?php echo $teacher;?></label><br /> 
             <label>Semester: <?php echo $row['sem']?> Sem</label><br /> 
            </div> 
          <?php endforeach; ?> 
         </table> 
         </div> 
        </div> 
       </div> 
      </div> 
     </div> 
    </div> 
</div> 
関連する問題