dynamic row height

Thread Solved

Join Date: Oct 2006
Posts: 82
Reputation: assgar is an unknown quantity at this point 
Solved Threads: 0
assgar assgar is offline Offline
Junior Poster in Training

dynamic row height

 
0
  #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.
  1. <?php
  2. $query = "SELECT event_id, event_date, event_time
  3. FROM cal_appointment
  4. WHERE status = 'A'
  5. ORDER BY event_date, event_time";
  6.  
  7. $result = mysqli_query($mysqli, $query) or die('Error, query failed');
  8. /************************ this section displays the events*************************/
  9.  
  10. echo "<table width=\"100%\" border=\"0\">";
  11. echo"<tr align=\"center\" bgcolor=\"#FFFFFF\">";
  12. echo" <td width=\"100%\" >
  13. <div id=\"Layer2\" style=\"position:absolute; width:100%; height:100px; z-index:2; left: 8px; top: 310px;\">
  14. <div id=\"scroll-box2\" style=\"overflow: auto; float: left; width: 100%; height: 240px; margin: 5px; \">\n";
  15. //table begins
  16. echo "<table width=\"98%\" height=\"310\" left =\"4\" border=\"0\" font face =\"arial\">\n";
  17. $result = mysqli_query($mysqli,$query) or die('Error, query failed');
  18. $num_rows = mysqli_num_rows($result);
  19. for($i=0; $i < $num_rows; $i++)
  20. {
  21. $row = mysqli_fetch_array($result);
  22. list($event_id, $event_date, $event_time) = $row;
  23.  
  24. /**convert 24hr time to 12 hr**/
  25. list($hour, $min, $sec) = split(":",$event_time);
  26. if($hour > 12)
  27. {
  28. $time_hour = $hour - 12;
  29. }
  30. else
  31. {
  32. $time_hour = $hour;
  33. }
  34.  
  35. //format time of day
  36. if($hour < 12)
  37. {
  38. $tod = "AM";
  39. }
  40. else
  41. {
  42. $tod = "PM";
  43. }
  44. $time = "$hour:$min $tod";
  45. echo "<tr>";
  46. echo"<td width=\"18%\" height=\"15\" align=\"center\">$time</td>
  47. <td width=\"12%\" height=\"15\">$event_date</td>\n";
  48. echo "</tr>";
  49.  
  50. }//end for
  51.  
  52. echo "</table>";
  53. echo "</td>";
  54. echo "</tr>";
  55. echo "</div>";
  56. echo "</div>";
  57. echo "</table>";
  58. }
  59. ?>
Last edited by assgar; Jul 31st, 2007 at 1:06 pm. Reason: code tags
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,515
Reputation: Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future 
Solved Threads: 523
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: dynamic row height

 
0
  #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 Quick reply to this message  
Join Date: Oct 2006
Posts: 82
Reputation: assgar is an unknown quantity at this point 
Solved Threads: 0
assgar assgar is offline Offline
Junior Poster in Training

Re: dynamic row height

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

You were right the table height was the issue.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum


Views: 1849 | Replies: 2
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC