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";
?>

Link to comment
Share on other sites

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";
?>

Link to comment
Share on other sites

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;
}

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.