Jump to content

Table Display in IE -- PHP or just a problem with my tables? HELP!


sw9

Recommended Posts

Hi all,

 

I have a webpage that is working great in Firefox and Safari, but when I go to IE (6)  it displays my tables on top of each other (of course!). I am not sure if it's in my PHP loop or just a problem with my tables, so I was hoping someone could take a look for me. The page I am talking about is http://www.retn.org/crv.php (please look in Firefox and IE 6 -- not sure if it does it in 7). Below is the code I'm using to generate my tables. The end of the table is at the end of the code, and you can see it's followed by a

<br>

. So why does IE do this to me? Any way I can resolve it? Thank you very much in advance!

 

<?php // Set the academic year variables so we can get the correct queries
$thisYear = date('Y');
$lastYear = date('Y') - 1;
$monthStart = '0901';
$monthEnd = '0701';
$firstYear = '1996';

// Start with a FOR loop to set up the proper years, then loop through mySQL results to put them in the right tables
for($i=$thisYear;$i>=$firstYear;$i--){
$startDate = $i.'0901';
$endDate = ($i+1).'0831';
        
         // This query takes the above variables from the for loop and determines if a result should go in the current table in the loop.
$crv = "SELECT a.episode_name, a.length, a.title, a.acq_date, a.archive FROM mprogram_library AS a
		LEFT JOIN msn AS b ON (a.title = b.title_num)
		WHERE a.series_id = '15'
		AND a.acq_date >= '".$startDate."'
		AND a.acq_date <= '".$endDate."'
		GROUP BY a.title
		ORDER BY a.acq_date DESC";

$rval = mysql_query($crv);		
$row = 0;
$results = mysql_num_rows ($rval);
//If there are results, display them, otherwise don't show an empty table.	
if($results > 0){

?>
<table width="85%" align="left" border="0" cellspacing="0" cellpadding="4"><?php
print "<tr><td> </td></tr><td class=\"textboldbig\">".$i." - ".($i + 1)." Academic Year</td></tr>";?>

  <tr class="textboldbig">
  
<td nowrap bgcolor="#777257"><span style="color:#FFFFFF">Episode</span></td>
    <td nowrap bgcolor="#777257"><span style="color:#FFFFFF">Production Date</span></td>
    <td nowrap bgcolor="#777257"><span style="color:#FFFFFF">Video-On-Demand</span></td>

  </tr>
<?php
while( $data = mysql_fetch_assoc( $rval ) ){ 
//If the video is in the archives, change the text to red.
       if($data["archive"] == '1'){
$class = "archivebig";
}else{
$class = "schedulelinksbig";
}

	++$row;
	$bgColor = $row % 2 == 0?"#CBC497":"#E4DFC6";
	$program_link = "CRV-VOD.php?title=".$data["title"];
	print "<tr style=\"background:".$bgColor."\"><td><a href=\"".$program_link."\" target=\"_self\" class=\"".$class."\">".$data["episode_name"]."</a></td>
	<td><a href=\"".$program_link."\" target=\"_self\" class=\"".$class."\">".retn_date($data["acq_date"])."</a></td>";

//This mySQL statement just checks to see if there is streaming video available.
$vid_sql = "SELECT a.title, b.msn_id, b.title_num, b.program_type, b.status, b.filename
				FROM mprogram_library as a LEFT JOIN msn as b ON (a.title = b.title_num) 
				WHERE b.program_type = 'DV File' AND b.status = 'A' AND a.title =".$data["title"];


$eval = mysql_query ( $vid_sql );
$vidRows = mysql_num_rows($eval);
//If there is video available, display "Yes", otherwise display "Not Yet"
        if ($vidRows > 0){
while ($return = mysql_fetch_assoc ($eval ) ){

?>
<td align="center"><a href="<?php echo $program_link; ?>" class="<?=$class;?>"><?php if ($return["program_type"] == 'DV File' && $return["status"] == 'A') {echo "Yes"; } ?></a></td>
<?php  } // End WHILE Video Loop 
}else{ // Else if there is no streaming video, display "Not Yet"?>

<td align="center"><a href="<?php echo $program_link; ?>" class="<?=$class;?>">Not Yet</a></td><?php } ?>

</tr><?php
        } // End Main WHILE Loop
// HERE IS WHERE I END THE TABLE IN THE LOOP AND THE NEXT ONE WILL START. 
        print "</table><br>";
} // End if results

} // End the FOR loop for each academic year

?>


Link to comment
Share on other sites

Not a php problem. HTML problem.

 

There are several errors in your html. No doctype for a start.

 

You have missed off <tr> in this part of code:

 

  </tr></table><br><br><table width="85%" align="left" border="0" cellspacing="0" cellpadding="4"><tr><td> </td></tr><td class="textboldbig">2006 - 2007 Academic Year</td></tr>

Link to comment
Share on other sites

deansatch -- thanks for that miss. I did fix that. However, I realized the issue was the table align="left". IE wanted to line all the tables on top of each other and was not acknowledging the br tag. Removing that fixed the problem.

 

Also, thanks for the doctype heads up. My designers made templates for these pages, and I can't believe they left that out. Thank you. sw

Link to comment
Share on other sites

I hate to tell you this, but you need to hire a new designer. You are using tables incorrectly, doctypes are essential, and the align tag has been deprecated. And thats just the tip of the iceburg. If you are paying this person, then stop, and find someone who knows how to write proper code.

Link to comment
Share on other sites

haku -- thanks. my org is very very small, non profit and pretty much 0 budget. Do you have a good resource link on where to start learning how to properly do this via either css or still using tables? My designer would like to learn. Thanks.

Link to comment
Share on other sites

Books on CSS are good if he is the reading type. If he isn't, then lynda.com has some good video courses on CSS (its where I first learned) that are a great way to get into CSS.

 

Once he starts, he wont want to stop. Tables are the way of the past.

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.