Problem with correct placing of tables posted with php - sql, Might be a styling issue |
Problem with correct placing of tables posted with php - sql, Might be a styling issue |
sanoj96 |
Mar 12 2017, 01:28 PM
Post
#1
|
Advanced Member Group: Members Posts: 118 Joined: 18-September 12 Member No.: 17,803 |
Hello,
So i have been messing around a bit now with one of my websites, and have ran into a problem i cant see to find out. So i am asking for some help.. So when i try to post a table from php with information from sql it places at the wrong area.. This are the following files are in use in this action. index.php CODE <?php //create_cat.php include 'connect.php'; include 'header.php'; $sql = "SELECT categories.cat_id, categories.cat_name, categories.cat_description, COUNT(topics.topic_id) AS topics FROM categories LEFT JOIN topics ON topics.topic_id = categories.cat_id GROUP BY categories.cat_name, categories.cat_description, categories.cat_id"; $result = mysql_query($sql); if(!$result) { echo 'The categories could not be displayed, please try again later.'; } else { if(mysql_num_rows($result) == 0) { echo 'No categories defined yet.'; } else { //prepare the table echo '<table class="table table-striped"> <tr> <th>Category</th> <th>Last topic</th> </tr>'; while($row = mysql_fetch_assoc($result)) { echo '<tr>'; echo '<td class="leftpart">'; echo '<h3><a href="category.php?id=' . $row['cat_id'] . '">' . $row['cat_name'] . '</a></h3>' . $row['cat_description']; echo '</td>'; echo '<td class="rightpart">'; //fetch last topic for each cat $topicsql = "SELECT topic_id, topic_subject, topic_date, topic_cat FROM topics WHERE topic_cat = " . $row['cat_id'] . " ORDER BY topic_date DESC LIMIT 1"; $topicsresult = mysql_query($topicsql); if(!$topicsresult) { echo 'Last topic could not be displayed.'; } else { if(mysql_num_rows($topicsresult) == 0) { echo 'no topics'; } else { while($topicrow = mysql_fetch_assoc($topicsresult)) echo '<a href="topic.php?id=' . $topicrow['topic_id'] . '">' . $topicrow['topic_subject'] . '</a> at ' . date('d-m-Y', strtotime($topicrow['topic_date'])); } } echo '</td>'; echo '</tr>'; } } } ?> <?php include 'footer.php'; ?> The problem is that everything that is a table is under the footer (only on index.php & if you click on a topic / Category. but if i click on the post it is above the footer.) Link to site: http://solitudegaming.com/forum Hope anyone can help me with this issue. Thanks. |
Lo-Fi Version | Time is now: 27th April 2024 - 09:55 PM |