Alternating Tables
Posted: Mon Jul 26, 2004 9:48 am
Hi, new guy here 
New to PHP and trying to accomplish a task that I think is simple but I'm not sure on how to exactly code it. Here is the page in question:
http://www.ancient-sun.com/newsite/structure.php
The info in the tables is taken from a database. Basically, on the left hand side I want people listed with a certain identifying variable, and on the other side people liisted with another identifying variable. Basically I want the script to be intelligent and put certain people in one category and the others in the other one
I sort of did it, but I'm getting the blank boxes. I'm not really sure how to correct it, here's my code:
Any help is appreciated. Thanks! 
feyd | switched
New to PHP and trying to accomplish a task that I think is simple but I'm not sure on how to exactly code it. Here is the page in question:
http://www.ancient-sun.com/newsite/structure.php
The info in the tables is taken from a database. Basically, on the left hand side I want people listed with a certain identifying variable, and on the other side people liisted with another identifying variable. Basically I want the script to be intelligent and put certain people in one category and the others in the other one
I sort of did it, but I'm getting the blank boxes. I'm not really sure how to correct it, here's my code:
Code: Select all
<?php
mysql_connect('localhost', '*****', '*****');
mysql_select_db('*****');
$query = "SELECT personal.username,
mainchar.mainname, mainchar.username, mainchar.title, mainchar.rank, mainchar.division
FROM personal, mainchar WHERE personal.username = mainchar.username ORDER BY personal.username";
$result = mysql_query($query);
echo "
<TR>
<TD ALIGN = left CLASS = 'tabletop'>
<DIV CLASS = 'tabletitle'>
<B>The Ancient Hand</B>
</TD>
<TD ALIGN = left CLASS = 'tabletop'>
<DIV CLASS = 'tabletitle'>
<B>The Ancient Shield</B>
</TD>
</TR>";
while ($query_data = mysql_fetch_row($result)) {
if($i % 2) {
echo"<TR BGCOLOR = '#31200A'>";
}
else {
echo"<TR BGCOLOR = '#160D01'>";
}
echo "
<TD>";
if($query_data[5] == "Hand") {
echo "
<FONT COLOR = '#FFFFFF' FACE = 'tahoma' SIZE = '2'>
<B>$query_data[1]</B> the $query_data[3]<BR>
$query_data[4]<BR>
($query_data[0])
";
}
echo "</TD><TD>";
if ($query_data[5] == "Shield") {
echo "
<FONT COLOR = '#FFFFFF' FACE = 'tahoma' SIZE = '2'>
<B>$query_data[1]</B> the $query_data[3]<BR>
$query_data[4]<BR>
($query_data[0])
";
}
echo "
</TD></TR>";
++$i;
}
?>feyd | switched
Code: Select all
toCode: Select all
tag[/color]