Two different types of Titles

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
CoolAsCarlito
Forum Contributor
Posts: 192
Joined: Sat May 31, 2008 3:27 pm
Contact:

Two different types of Titles

Post 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>';
 
 
 
?>
 
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: Two different types of Titles

Post by ghurtado »

You are writing a TR tag for each row, therefore making the records display from top to bottom.
Post Reply