Page 1 of 1

odd table behaviour in a loop

Posted: Thu Jan 19, 2006 5:30 pm
by $var
can someone look at this page and make a suggestion as to why it's popping out so oddly in the middle.
perhaps it's happened before to you?
i'll post the code if you want.

http://www.meaghanbent.com/client/valerygore/shows.php

Posted: Thu Jan 19, 2006 5:51 pm
by Christopher
Check the HTML you are generating. For each block there are 4 </table> tags, but only 2 <table ... > tags.

Posted: Thu Jan 19, 2006 11:39 pm
by feyd
Moved to Client Side.

Posted: Sun Jan 22, 2006 10:21 pm
by $var
i don't think that this is the problem...
it's not in the table...

i did a manual check and lined up all the tags... there are the proper open and close.
is there perhaps a character in the database that could throwing it?

Code: Select all

<? $totalpages = intval(($numrecords[0])/$intRecsPerPage);
	if(intval($numrecords[0]/$intRecsPerPage) != ($numrecords[0]/$intRecsPerPage))
		{
			$totalpages = $totalpages + 1;
		}
	for($x = (($intpage-1) * $intRecsPerPage); $x < (($intpage-1) * $intRecsPerPage) + $intRecsPerPage; $x++)
		{
			if($x >= $numrecords[0])
		{
			break;
		}
		$listingresults = mysql_fetch_array($result);
?>
 	<table width="104%" height="101" border="0" cellpadding="0" cellspacing="0" id="here">
    	<tr> 
           <td height="66" background="http://www.valerygore.com/images/bg4.jpg">
		   		<table width="97%" border="0" align="center" cellpadding="0" cellspacing="2">
                    <tr class="textmaroon"> 
                       <td width="25%"><strong>Date:</strong></td>
                       <td width="70%" bgcolor="#CC9966"><strong>Venue:</strong></td>
                       <td width="5%"><strong>Cover:</strong></td>
                    </tr>
                    <tr valign="top" class="textmaroon"> 
                        <td height="48" class="dateinfo"><? echo $listingresults["Event_Date"]; ?><br><a href='editevent.php?ID=<? echo $listingresults["Event_ID"]; ?>'><? echo $listingresults["Event_Settime"]; ?></a><br></td>
                        <td class="textblack"><? echo $listingresults["Event_Venue"]; ?><br><? echo $listingresults["Event_Address"]; ?>, <? echo $listingresults["Event_City"]; ?></td>
                        <td class="textblack"><? echo $listingresults["Event_Cover"];?></td>
                    </tr>
                </table>
			</td>
         </tr>
         <tr> 
            <td height="32" valign="top">
				<table width="100%" height="32" border="0" align="center" cellpadding="2" cellspacing="2" background="http://www.valerygore.com/images/bg3.jpg">
                   <tr> 
                       <td height="28" valign="top" background="http://www.valerygore.com/images/bg3.jpg" class="textmaroonbox"><p class="dateinfo">
									<? 
									$rank = $listingresults['Event_Rank'];
									$bands = $listingresults['Event_Bands'];
									if ($rank == 0) {
									echo "With: $bands <br>"; }
									elseif ($rank == 1 ) {
									echo "In Support of: $bands <br>";
									}
									
									$info = $listingresults['Event_Info'];
									$image = $listingresults['Event_Info'];
									if (empty($info)) {
									echo ""; }
									else {
									echo "$info";
									}
									
									$image = $listingresults['Event_Image'];
									if (empty($image)) {
									echo ""; }
									else {
									echo "<img src='$image' width='' heigth='' hspace='2' vspace='2' boreder='1' align='left'>";
									}
																		 
									$lic = $listingresults['Event_Lic'];
									if ($lic == 0) {
									echo "<br>This is an All Ages event."; }
									elseif ($lic == 1 ) {
									echo "<br>This is a 19+ Only event.";
									}
									elseif (empty($lic)){
									echo "";}
									?>
				        </td>
			       </tr>
                </table>
			</td>
		</tr>
   </table>				 
<? } ?>
Check out the behaviour... it only starts half way through the loop.
Seems like there could be something that is being drawn from the database that could be throwing the width out?

Posted: Mon Jan 23, 2006 6:05 am
by raghavan20
I observed something from view source

Code: Select all

<table width="104%" height="101" border="0" cellpadding="0" cellspacing="0" id="here">
                          <tr>
                            <td height="66" background="http://www.valerygore.com/images/bg4.jpg"><table width="97%" border="0" align="center" cellpadding="0" cellspacing="2">
                                <tr class="textmaroon">
                                  <td width="25%"><strong>Date:</strong></td>
                                  <td width="70%" bgcolor="#CC9966"><strong>Venue:</strong></td>
                                  <td width="5%"><strong>Cover:</strong></td>
                                </tr>
                                <tr valign="top" class="textmaroon">
                                  <td height="48" class="dateinfo">Tuesday<bTue,  7 Mar 2006 00:00:00 -0800>, March 07 <br>
                                      <a href='editevent.php?ID=35'></a><br>                                  </td>
                                  <td class="textblack">Mitzi's Sister<br>
                                      1554 Queen St. W., Toronto, ON</td>
                                  <td class="textblack">Free</td>
                                </tr>
                            </table></td>
                          </tr>
                          <tr>
                            <td height="32" valign="top"><table width="100%" height="32" border="0" align="center" cellpadding="2" cellspacing="2" background="http://www.valerygore.com/images/bg3.jpg">
                                <tr>
                                  <td height="28" valign="top" background="http://www.valerygore.com/images/bg3.jpg" class="textmaroonbox"><p class="dateinfo">
                                      With: Songwriters' Night
 <br>                                  </tr>
                            </table></td>
                          </tr>
                        </table></td>
                      </tr>
                    </table>
This piece of code from the above code...

Code: Select all

<table width="104%" height="101" border="0" cellpadding="0" cellspacing="0" id="here">
This width=104% is definitely going to exceed the screen size unless you wrap it in another container, a table or div.

You can find out any missing tags by using XHTML validator from w3.org

Posted: Mon Jan 23, 2006 3:56 pm
by $var
whoa... so i checked the page on the validator, and i see so much that i need to know about.
i'm guessing the w3 org has a list on there somewhere of what all the DOC types are, because mine doesn't even validate.

how would the page read online, but not be a valid document?
it's php, not xhtml... but even the pregenerated php DOCTYPE from Dreamweaver doesn't validate.

Posted: Mon Jan 23, 2006 4:21 pm
by Roja
$var wrote:whoa... so i checked the page on the validator, and i see so much that i need to know about.
Don't feel bad. The overwhelming majority of pages on the net do not validate yet, including yahoo, google, and so on. Becoming an expert means learning these little tricks of the trade, and knowing when to apply them.
$var wrote:i'm guessing the w3 org has a list on there somewhere of what all the DOC types are, because mine doesn't even validate.
They sure do! : http://www.w3.org/QA/2002/04/valid-dtd-list.html
$var wrote:how would the page read online, but not be a valid document?
Its an unfortunate thing. In the original first days of the web, there were few 'standards', and the technology was developing so fast that you couldn't really standardize a solution fast enough to meet the needs of users. Ten years later, and now its considerably more reasonable in pace.

Or put another way, the browser manufacturers started the game by supporting non-standard code, and now can't stop supporting it all of a sudden - customers would complain!

In theory, xhtml2 is supposed to stop that. Its supposed to be the clean slate where the legacy items are left behind, and non-valid code will not be rendered.

Unfortunately, that draconian stance has resulted in xhtml2 being universally ignored. No one truly implements it according to the standard, and few plan to. Which in turn has led to the WHATWG team working on HTML5, which is html-4.1 with a number of interesting changes, but less brutal compliance requirements than xhtml2.
$var wrote:it's php, not xhtml... but even the pregenerated php DOCTYPE from Dreamweaver doesn't validate.
Remember, php is the processing language. Server-side. Its *output* can, and usually is, a variant of html. The two are related, and interact, but one is not the other.

You are talking about the output of your program, and getting THAT to be valid, not the php code. :)