Page 1 of 1

Two different types of Titles

Posted: Fri Aug 08, 2008 12:58 pm
by CoolAsCarlito
I have two different types of status: active and inactive. I want it to only show the active titles together and inactive titles seperately you'll understand when you see the page. I know I need two separate loops. I also need my titles to be across not going down. What's wrong with my code that's making it align down.

Here's the page it's located at http://www.kansasoutlawwrestling.com/titlehistory3.php

Code: Select all

 
<?php
 
// Connects to your Database
$link = mysql_connect("?", "?", "?") or die(mysql_error());
mysql_select_db("?",$link) or die(mysql_error());
 
if (!mysql_select_db("?", $link)) {
echo 'Could not select database';
exit;
}
 
print '<table border=0 cellspacing="0" cellpadding=3 width=575>';
print '<tr><td background="images/bg_bar4.gif" height=35>&nbsp;Title Histories</td></tr>';
print '</table>';
print '<table border=0 cellspacing="0" cellpadding=3 width=575>';
print '<tr><td background="images/bg_bar3.gif" height=35 colspan=2>&nbsp;Active Titles</td></tr>';
 
//Define the query
$query = "SELECT * FROM titles";
 
if ($r = mysql_query ($query)){ // Run the query. 
 
while ($row = mysql_fetch_array ($r)){
 
print '<tr><td><a href="titlehistories.php?id=' . $row['id'] . '" title="View KOW '.$row['titlename'].' History">';
print '<img src="/images/' . $row['titleimage'] . '" border=0 alt="View KOW '.$row['titlename'].' History" height="115px" width="115px"></a>';
 
}
 
} else {
die ('<p>Could not retrieve the data because <b>' . mysql_error() . '</b>. The query was $query.</p>');
} //End of query IF 
 
print '</td></tr>';
print '</table>';
print '<img src=images/spacer.gif><br>';
print '<table border=0 cellspacing=0 cellpadding=3 width=575><tr><td background="images/bg_bar3.gif" height=35 colspan=2>&nbsp;Inactive Titles</td></tr>';
print '<tr><td></td></tr>';
print '</table>';
 
 
 
?>
 

Re: Two different types of Titles

Posted: Fri Aug 08, 2008 2:19 pm
by ghurtado
You are writing a TR tag for each row, therefore making the records display from top to bottom.