Sarabveer Posted May 7, 2016 Share Posted May 7, 2016 (edited) <?php function getFullMonthName($num) { if ($num < 1 || $num > 12) { return "Unknown"; } return ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"][$num - 1]; } $ids = mysqli_real_escape_string($db, $id); $sql = "SELECT * FROM multimedia, keertan WHERE multimedia.id LIKE '$ids' AND keertan.multimediaid LIKE '$ids' ORDER BY k_order ASC"; $result = mysqli_query($db, $sql); $title_list = "xyz"; $done = "xyz"; while ($myrow = mysqli_fetch_array($result)) { $location = $myrow["location"]; $program = $myrow["program"]; $year = sprintf("%04s", $myrow["year"]); $month = sprintf("%02s", $myrow["month"]); $monthName = getFullMonthName($month); $isnew = $myrow["isnew"]; if ($done != "true") { echo "<h3><b>$location $program $monthName $year</b></h3>"; } $done = "true"; while ($title_list != $myrow["title"]) { $title_list = $myrow["title"]; $sublist = $myrow["sub_title"]; echo "<div class=\"panel panel-primary\"><div class=\"panel-heading clickable\"><h3 class=\"panel-title\"><b>$title_list</b></h3>"; echo "<small>$sublist</small><span class=\"pull-right\"><i class=\"fa fa-minus\"></i></span></div><div class=\"panel-sarabveer-table\"><table class=\"table\"><thead><tr><th>Time</th><th>Kirtani</th><th>MP3</th><th>Video</th></thead>"; } if (strtotime($myrow["created"]) > strtotime("3 weeks ago")) { $newed = "NEW"; } elseif (strtotime($myrow["modified"]) > strtotime("3 weeks ago")) { $newed = "UPDATED"; } else { $newed = ""; } printf("<tr><td>%s</td><td>%s <small>%s</small></td>", $myrow["length"], $myrow["keertaneeya"], $newed); $mp3f = urlencode($myrow['mp3_link']); if ($myrow["mp3_link"] != "") { printf("<td><a target=\"_blank\" href=\"http://www.akji.org.uk/multimedia/%s/%s/%s\"><img src=\"images/play.png\" border=\"0\" width=\"25\" height=\"25\"></a></td>", $myrow["location"], $year, $mp3f); } else { echo "<td></td>"; } if ($myrow["rv1_link"] != "") { printf("<td><a target=\"_blank\" href=\"%s\"><img src=\"images/vplay.png\" border=\"0\" width=\"25\" height=\"25\"></a></td></tr>", $myrow["rv1_link"]); } else { echo "<td></td></tr>"; } echo "</table></div></div>"; } ?> So Basically I have this code that displays this page: https://akjmobile.org/keertannew.php?id=532 The problem is that the echo on line 97 runs to early and cuts of rest of the table information, making the other table information be spit out outside of the Bootstrap Panel. How would I fix this? Edited May 7, 2016 by Sarabveer Quote Link to comment https://forums.phpfreaks.com/topic/301175-need-help-with-while-and-bootstrap-tables/ Share on other sites More sharing options...
taquitosensei Posted May 16, 2016 Share Posted May 16, 2016 echo "<div class=\"panel panel-primary\"><div class=\"panel-heading clickable\"><h3 class=\"panel-title\"><b>$title_list</b></h3>"; echo "<small>$sublist</small><span class=\"pull-right\"><i class=\"fa fa-minus\"></i></span></div><div class=\"panel-sarabveer-table\"><table class=\"table\"><thead><tr><th>Time</th><th>Kirtani</th><th>MP3</th><th>Video</th></thead>"; Is inside your database loop. You're creating a panel and table for every single result. If that's not what you're intending to do I would move this and line 97 outside of your database loop. Quote Link to comment https://forums.phpfreaks.com/topic/301175-need-help-with-while-and-bootstrap-tables/#findComment-1533015 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.