skip to Main Content

I am trying to display these data horizontally, the problem is it overlaps the headers and it only creates duplicate entry on 1st and 2nd rows of the table.

Here is an example of the problem:

Column A Column B Column C Column D Column E No Column No Column No Column No Column
#1 20 30 40 50 30 25 15 10
#2 20 30 40 . 50. 30 25 15 10

What the correct should be is:

Column A Column B Column C Column D Column E
#1 20 30 40 50
#2 30 25 15 . 10

I’ve already construct the table like this:

   <div class="table-responsive">
                    <table class="table table-striped table-bordered" style="width:100%">
                        <tbody class="text-center">
                        <?php foreach($candidatesf as $candidate): ?>
                            
                            <tr> <td><?php echo $candidate['fullname'] ?></td>
                            <?php foreach($candscores as $candscore): ?>
                                <?php  echo "t<td>"; ?><?php echo $candscore['score']; ?></td>
                            <?php endforeach; ?>
                            <tr></tr>

                        <?php endforeach; ?>
                        </tbody>
                    </table>
               </div>

2

Answers


  1. You’re opening the table row
    Then you add some td elements.
    At the end, you open another and close that one.

    You have a syntax error here:

    <tr></tr>
    

    You should only close it like this:

    </tr>
    
    Login or Signup to reply.
  2.   <tbody class="text-center">
        <?php foreach($candidatesf as $candidate): ?>       
            <tr> 
                <td><?php echo $candidate['fullname'] ?></td>
                <?php foreach($candscores as $candscore): ?>
                    <td><?php echo $candscore['score']; ?></td>
                <?php endforeach; ?>
            </tr>
        <?php endforeach; ?>
      </tbody>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search