RSS Forums RSS
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1036 | Replies: 2 | Solved
Reply
Join Date: Oct 2006
Posts: 76
Reputation: assgar is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
assgar assgar is offline Offline
Junior Poster in Training

Help dynamic row height

  #1  
Jul 31st, 2007
Hi
I am having a problem with the height of my dynamically create rows.
The data is retrived properly form the database, the issue is displaying the rows.

When there are alot of results to dusplay the rows are displayed correctly.
If there are a few rows the hight can be 3 times the height as when there alot of rows.

Note: Below is a simplified version of the code.
<?php 
$query = "SELECT event_id, event_date, event_time
FROM cal_appointment
WHERE status = 'A'
ORDER BY event_date, event_time";
 
$result = mysqli_query($mysqli, $query) or die('Error, query failed');
/************************ this section displays the events*************************/
 
echo "<table width=\"100%\" border=\"0\">";
echo"<tr align=\"center\" bgcolor=\"#FFFFFF\">";
echo" <td width=\"100%\" >
<div id=\"Layer2\" style=\"position:absolute; width:100%; height:100px; z-index:2; left: 8px; top: 310px;\">
<div id=\"scroll-box2\" style=\"overflow: auto; float: left; width: 100%; height: 240px; margin: 5px; \">\n";
//table begins
echo "<table width=\"98%\" height=\"310\" left =\"4\" border=\"0\" font face =\"arial\">\n";
$result = mysqli_query($mysqli,$query) or die('Error, query failed');
$num_rows = mysqli_num_rows($result);
for($i=0; $i < $num_rows; $i++)
{
$row = mysqli_fetch_array($result);
list($event_id, $event_date, $event_time) = $row;
 
/**convert 24hr time to 12 hr**/
list($hour, $min, $sec) = split(":",$event_time);
if($hour > 12)
{
$time_hour = $hour - 12;
}
else
{
$time_hour = $hour;
}
 
//format time of day
if($hour < 12)
{
$tod = "AM";
}
else
{
$tod = "PM";
}
$time = "$hour:$min $tod";
echo "<tr>";
echo"<td width=\"18%\" height=\"15\" align=\"center\">$time</td>
<td width=\"12%\" height=\"15\">$event_date</td>\n";
echo "</tr>";
 
}//end for
 
echo "</table>";
echo "</td>";
echo "</tr>";
echo "</div>";
echo "</div>";
echo "</table>";
}
?>
Last edited by assgar : Jul 31st, 2007 at 1:06 pm. Reason: code tags
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2007
Location: USA
Posts: 3,176
Reputation: Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold Ezzaral is a splendid one to behold 
Rep Power: 15
Solved Threads: 314
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Posting Sensei

Re: dynamic row height

  #2  
Jul 31st, 2007
I would assume that is because you have explicitly set the table height. If you only give it a couple of rows, those rows will fill the available height.
Reply With Quote  
Join Date: Oct 2006
Posts: 76
Reputation: assgar is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
assgar assgar is offline Offline
Junior Poster in Training

Re: dynamic row height

  #3  
Jul 31st, 2007
Thanks for the response.

You were right the table height was the issue.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 6:58 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC