Jump to content

[SOLVED] Aligning Tables on Page


twilitegxa

Recommended Posts

Take 962:

 

<?php
$result = mysql_query("SELECT * FROM stats where identity = 'Sailor Moon'") 
or die(mysql_error());  
$row = mysql_fetch_array( $result );
echo "<table width='100%' valign='top'><tr><td width='50%' align='right' valign='top'>\n"; // added align='right' valign='top'
echo "<table width='100%' border='0' id='stats' align='right'>\n";
// keeps getting the next row until there are no more to get
echo "<tr><td colspan='3' id='th'>Stats And Derived Values</td></tr>\n";
echo "<tr><td>\n"; 
	echo "<b>Body:</b></td><td col class='right'>\n"; 
	echo $row['body'];
echo "</td></tr><tr><td>\n"; 
	echo "<b>Mind:</b></td><td col class='right'>\n";
	echo $row['mind'];
echo "</td></tr><tr><td>\n"; 
	echo "<b>Soul:</b></td><td col class='right'>\n";
	echo $row['soul'];
echo "</td></tr><tr><td>\n";
	echo " </td></tr><tr><td>\n";
	echo "<b>Health Points:</b></td><td col class='right'>\n"; 
	echo $row['health'];
echo "</td></tr><tr><td>\n"; 
	echo "<b>Energy Points:</b></td><td col class='right'>\n"; 
	echo $row['energy'];
echo "</td></tr><tr><td>\n"; 
	echo "<b>Attack Combat Value:</b></td><td col class='right'>\n"; 
	echo $row['acv'];
echo "</td><td col class='right'>\n"; // added </td>
	echo " (";
	echo $row['acv_sa'];
	echo " for Sailor Scout Attack)";
echo "</td>\n";
echo "</td></tr><tr><td >\n"; 
	echo "<b>Defense Combat Value:</b></td><td col class='right'>\n"; 
	echo $row['dcv'];
echo "</td><td col class='right'>\n"; // added </td>
	echo " (";
	echo $row['dcv_sa'];
	echo " for Sailor Scout Attack)";
//echo "</td>\n"; // that's an extra one
echo "</td></tr><tr><td>\n";   
	echo "<b>Total Character Points:</b></td><td col class='right'>\n"; 
	echo $row['tcp'];
echo "</td></tr>\n"; 
echo "</table>\n";
echo "</td><td valign='top' width='50%' rowspan='2'>\n"; // added this whole line
echo "<table width='100%' border='0' id='stats' align='left'>\n";
echo "<tr><td colspan='7' id='th'>Character Attributes And Sub-Attributes</td></tr>\n";
echo "<tr class='sub'><td>Attribute/Sub-Attribute</td><td colspan='3' align='center'>Level</td><td colspan='3' align='center'>Points</td></tr>\n";
echo "<tr><td></td></tr>\n";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
	echo "<tr><td>\n"; 
		echo $row['attribute_id'];
		echo " ";
		echo $row['desc'];
	echo "</td><td width='2%'> </td><td width='1%' align='right'>\n";
		echo $row['level'];
	echo "</td><td width='2%'> </td><td width='2%'> </td><td width='1%' align='right'>\n";
		echo $row['points'];
	echo "</td><td width='2%'> </td></tr>\n";
}
echo "</table></td></tr><tr><td valign='top' width='50%'>\n";		
$result = mysql_query("SELECT * FROM character_defects where identity = 'Sailor Moon' ORDER BY defect_id ASC") 
or die(mysql_error());  
$row = mysql_fetch_array( $result );
echo "<table border='0' width='100%' id='stats' align='right'>\n";
echo "<tr><td colspan='3' id='th'>Character Defects</td></tr>\n";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
	echo "<tr><td>\n"; 
		echo $row['defect_id'];
		echo " ";
		echo $row['desc'];
	echo "</td><td>\n";
		echo $row['bp'];
		echo " BP";
	echo "</td></tr>\n";
}
echo "</table>\n";
echo "</td><td>\n";		
$result = mysql_query("SELECT * FROM character_attributes ORDER BY attribute_id ASC") 
or die(mysql_error());  
$row = mysql_fetch_array( $result );
echo "</td></tr></table>\n";
?>

Yeah, my bad. I copied part of it and missed another. Try this one:

 

<?php
$result = mysql_query("SELECT * FROM stats where identity = 'Sailor Moon'") 
or die(mysql_error());  
$row = mysql_fetch_array( $result );
echo "<table width='100%' valign='top'><tr><td width='50%' align='right' valign='top'>\n"; // added align='right' valign='top'
echo "<table width='100%' border='0' id='stats' align='right'>\n";
// keeps getting the next row until there are no more to get
echo "<tr><td colspan='3' id='th'>Stats And Derived Values</td></tr>\n";
echo "<tr><td>\n"; 
	echo "<b>Body:</b></td><td col class='right'>\n"; 
	echo $row['body'];
echo "</td></tr><tr><td>\n"; 
	echo "<b>Mind:</b></td><td col class='right'>\n";
	echo $row['mind'];
echo "</td></tr><tr><td>\n"; 
	echo "<b>Soul:</b></td><td col class='right'>\n";
	echo $row['soul'];
echo "</td></tr><tr><td>\n";
	echo " </td></tr><tr><td>\n";
	echo "<b>Health Points:</b></td><td col class='right'>\n"; 
	echo $row['health'];
echo "</td></tr><tr><td>\n"; 
	echo "<b>Energy Points:</b></td><td col class='right'>\n"; 
	echo $row['energy'];
echo "</td></tr><tr><td>\n"; 
	echo "<b>Attack Combat Value:</b></td><td col class='right'>\n"; 
	echo $row['acv'];
echo "</td><td col class='right'>\n"; // added </td>
	echo " (";
	echo $row['acv_sa'];
	echo " for Sailor Scout Attack)";
echo "</td>\n";
echo "</td></tr><tr><td >\n"; 
	echo "<b>Defense Combat Value:</b></td><td col class='right'>\n"; 
	echo $row['dcv'];
echo "</td><td col class='right'>\n"; // added </td>
	echo " (";
	echo $row['dcv_sa'];
	echo " for Sailor Scout Attack)";
//echo "</td>\n"; // that's an extra one
echo "</td></tr><tr><td>\n";   
	echo "<b>Total Character Points:</b></td><td col class='right'>\n"; 
	echo $row['tcp'];
echo "</td></tr>\n"; 
echo "</table>\n";
$result = mysql_query("SELECT * FROM character_attributes ORDER BY attribute_id ASC") 
or die(mysql_error());  
$row = mysql_fetch_array( $result );
echo "</td><td valign='top' width='50%' rowspan='2'>\n"; // added this whole line
echo "<table width='100%' border='0' id='stats' align='left'>\n";
echo "<tr><td colspan='7' id='th'>Character Attributes And Sub-Attributes</td></tr>\n";
echo "<tr class='sub'><td>Attribute/Sub-Attribute</td><td colspan='3' align='center'>Level</td><td colspan='3' align='center'>Points</td></tr>\n";
echo "<tr><td></td></tr>\n";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
	echo "<tr><td>\n"; 
		echo $row['attribute_id'];
		echo " ";
		echo $row['desc'];
	echo "</td><td width='2%'> </td><td width='1%' align='right'>\n";
		echo $row['level'];
	echo "</td><td width='2%'> </td><td width='2%'> </td><td width='1%' align='right'>\n";
		echo $row['points'];
	echo "</td><td width='2%'> </td></tr>\n";
}
echo "</table></td></tr><tr><td valign='top' width='50%'>\n";		
$result = mysql_query("SELECT * FROM character_defects where identity = 'Sailor Moon' ORDER BY defect_id ASC") 
or die(mysql_error());  
$row = mysql_fetch_array( $result );
echo "<table border='0' width='100%' id='stats' align='right'>\n";
echo "<tr><td colspan='3' id='th'>Character Defects</td></tr>\n";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
	echo "<tr><td>\n"; 
		echo $row['defect_id'];
		echo " ";
		echo $row['desc'];
	echo "</td><td>\n";
		echo $row['bp'];
		echo " BP";
	echo "</td></tr>\n";
}
echo "</table>\n";
echo "</td><td>\n";		
echo "</td></tr></table>\n";
?>

I think in Firefox you need to add the thickness and color of your border. Try something like this in your CSS:

 

#stats {
  border-width: 3px; //you'll have to play with the thickness
  border-color: #000000;
  border-style: ridge;
  table-column: right;
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.