I have som trouble finding out what i am doing wrong. I am using Bootstrap Table in a foreach loop
Foreach($fetchSite as $rows) { $sname = $rows['name']; echo "<div class='well'>" . "<h4>$sname</h4>"; foreach ($fetchDep as $rowd) { $depn = $rowd['dep']; echo "<h5>$depn:</h5>"; foreach($fetchUserdata as $row) { $uname = $row['username']; $team = $row['team']; $stime = $row['sttime']; $depna = $row['dep']; $siten = $row['name']; if($sname == $siten) { if($depn == $depna) { echo "<div class='row'>" . "<div class='table-responsive'>" . "<table class = 'table table-striped' style='width: 500px;'>" . "<thead><tr><th>Bruger:</th><th>Team:</th><th>startet:</th></tr></thead>"; echo "<tr><td>".$uname."</td><td>".$team."</td><td>".$stime."</td></tr>"; echo "<tbody>" . "</tbody>" . "</table>" . "</div>" . "</div>"; } } }//end Foreach FetchUSerdata }// end Foreach Depfetch echo "</div>"; } // End Foreach FetchSite The problem is that there are to many Bruger:, Team: and startet
i only want 1 line of Bruger, Team: and startet and then the users listed below. I know where the problem is:
if($depn == $depna) { echo "<div class='row'>" . "<div class='table-responsive'>" . "<table class = 'table table-striped' style='width: 500px;'>" . "<thead><tr><th>Bruger:</th><th>Team:</th><th>startet:</th></tr></thead>"; echo "<tr><td>".$uname."</td><td>".$team."</td><td>".$stime."</td></tr>"; echo "<tbody>" . "</tbody>" . "</table>" . "</div>" . "</div>"; } But i dont no how to solve it. Sorry for my bad english and stupid question. Merry Christmas
