Jump to content

Spacing under HTML table rows


davidf85

Recommended Posts

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
Share on other sites

<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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.