davidf85 Posted September 12, 2011 Share Posted September 12, 2011 I am working on a page that has about 20 lines of php that I am placing below a table row. I have HTML content in the Table, and PHP code echoes another table row, but between the previous HTML row and the php echoed row, is a lot of white space. I am wondering if there is a way to keep the rows tight. Link to comment https://forums.phpfreaks.com/topic/246985-spacing-under-html-table-rows/ Share on other sites More sharing options...
TOA Posted September 12, 2011 Share Posted September 12, 2011 Can you show code? Link to comment https://forums.phpfreaks.com/topic/246985-spacing-under-html-table-rows/#findComment-1268449 Share on other sites More sharing options...
davidf85 Posted September 12, 2011 Author Share Posted September 12, 2011 <tr> <td align=center> <b>Classified Market</b> <br> United States<br> New Jersey<br> Atlantic County<br> <i>Animals</i><br><br><br> </td> </tr> <tr> <td> <table> <?php $link = mysql_connect('localhost','root', 'root') or DIE(mysql_error()); $db = mysql_select_db('advertisements') or DIE(mysql_error()); $page_name = "http://localhost/pagination.php"; $count = mysql_query("SELECT count(*) as cnt FROM advertisements"); if(!$count){ die("Error querying the Database:".mysql_error()); } $a=mysql_fetch_object($count); $total_ads = $a->cnt; $page = (isset($_GET["page"]))?$_GET["page"] : 1; $limit = (isset($_GET["limit"]))?$_GET["limit"] : 10; if((!$page) || (is_numeric($page) == false) || ($page < 0) || ($page > $total_ads)) { $page = 1; } if((!$limit) || (is_numeric($limit) == false) || ($limit < 10) || ($limit > 50)) { $limit = 10; } $total_pages=ceil($total_ads/$limit); $set_limit=($page*$limit)-$limit; $data=mysql_query("SELECt * FROM advertisements LIMIT $set_limit, $limit"); if(!$data) die(mysql_error()); $no_row = mysql_num_rows($data); if($no_row == 0) die("There are no advertisements in this category."); echo("<br>Records Per Page: <a href=$page_name?limit=10page=1> 10</a> | <a href=$page_name?limit=25&page=1> 25</a> | <a href=$page_name?limit=50&page=1> 50</a><br>"); $prev_page = $page - 1; if($prev_page >= 1) { echo("<b><<</b> <a href=$page_name?limit=$limit&page=$prev_page> <b>Previous Page</b></a>"); } for($a=1;$a<=$total_pages;$a++) { if($a == $page) { echo("<b>$a</b>"); } else { echo(" <a href=$page_name?limit=$limit&page=$a>$a </a>"); } } $next_page = $page + 1; if($next_page <= $total_pages) { echo(" <a href=$page_name?limit=$limit&page=$next_page><b>Next Page</b></a>>>"); } ?> </table> MOD EDIT: code tags added. Link to comment https://forums.phpfreaks.com/topic/246985-spacing-under-html-table-rows/#findComment-1268464 Share on other sites More sharing options...
Pikachu2000 Posted September 12, 2011 Share Posted September 12, 2011 When posting code, enclose it within the forum's . . . BBCode tags. Link to comment https://forums.phpfreaks.com/topic/246985-spacing-under-html-table-rows/#findComment-1268466 Share on other sites More sharing options...
Pikachu2000 Posted September 12, 2011 Share Posted September 12, 2011 My guess would be that it's because you nest a table in a <td> here: <tr> <td> <table> Then the next thing you echo is a line break <br>. The markup is invalid. Link to comment https://forums.phpfreaks.com/topic/246985-spacing-under-html-table-rows/#findComment-1268468 Share on other sites More sharing options...
cssfreakie Posted September 13, 2011 Share Posted September 13, 2011 just another thing, don't use breaks (<br />) to style your pages or tables it will get messy very fast. It's fine to use them inside a paragraph, but that is pretty much it in my opinion. Besides that if you have an online example or the actual html output (ctrl+u) so without the serverside code (php) Link to comment https://forums.phpfreaks.com/topic/246985-spacing-under-html-table-rows/#findComment-1268611 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.