Jump to content

Image Not Coded Right


Xtremer360

Recommended Posts

I'm wanting to make the pics that aren't showing be the images of the past champions. All the images of the champions are in the images folder. And are all (WrestlerName.jpg). And if there isn't an image of a past champion yet then I want it to put the image which is also in the images folder, comingsoon2.jpg.

 

Another thing I want done is the past champions is their name to be linked to their bio which is bio.php?id=(whatever id they are)

 

Following script is located at kansasoutlawwrestling.com/titlehistory.php?id=1

 

 

<?php echo "<body bgcolor=\"black\" text=\"white\" link=\"red\" vlink=\"red\">"; ?>

<?php
function dateConvert($date)
{
$eDat = explode("-",$date);
$year = $eDat[0];
$nMon = $eDat[1];
$day  = $eDat[2];
switch ($nMon)
{
	case 1:	 $mont = "January"; break;
	case 2:	 $mont = "February"; break; 
	case 3:	 $mont = "March"; break;
	case 4:	 $mont = "April"; break;
	case 5:	 $mont = "May"; break;
	case 6:	 $mont = "June"; break;
	case 7:	 $mont = "July"; break;
	case 8:	 $mont = "August"; break;
	case 9:	 $mont = "September"; break;
	case 10: $mont = "October"; break;
	case 11: $mont = "November"; break;
	case 12: $mont = "December"; break;	
} 
$out = $mont . " " . $day . ", " . $year;
return $out;
}
?>

<?php
// Connects to your Database
$link = mysql_connect("?", "?", "?") or die(mysql_error());
mysql_select_db("?",$link) or die(mysql_error());

if (isset($_GET['id']))
{	
// First, we need to get the champs, so do some mysql stuffs.
$qry0 = "SELECT * FROM `titlechamps` WHERE `title` = '".addslashes($_GET['id'])."';";
$res0 = mysql_query($qry0) or die('Qry zero error!');
if(!mysql_num_rows($res0)) $body = "";
else
{
	while($list0 = mysql_fetch_assoc($res0))
	{
		// We have at least one champ.
		// First, we have to do a little math. We need to determine 
		// how many days have elapsed between the date won and today.
		$today = explode("-",date("Y-m-d", time()));
		$yesterday = explode("-",$list0['date']);
		$hi = gregoriantojd($today[1],$today[2],$today[0]);
		$lo = gregoriantojd($yesterday[1],$yesterday[2],$yesterday[0]);
		$days = round($hi - $lo);

		// We will add the days and name to an array for the header.
		$longestR[] = $days . " - " . $list0['name'];
		// We also add the most successful defences to another array.
		$sucessfulD[] = $list0['defenses'] . " - " . $list0['name'];

		if($list0['news'] != null)
		$body .= "<table width=\"575\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\"><tbody><tr><td colspan=\"2\" bgcolor=\"#e0e0e0\" valign=\"top\" width=\"100%\"><i>".$list0['news']."</i></td></tr></tbody></table>\n";

		else
		$body .= 
		"<table width=\"575\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\"><tbody>\n".
			"<tr>\n".
			"<td width=\"115\" valign=\"top\" align=\"center\"><img src=\"".$list0['pic']."\" height=115px width=115px/></td>\n".
			"<td>\n".
			"<table width=\"100%\" cellspacing=\"1\" cellpadding=\"2\" border=\"0\"><tbody><tr>\n".
				"<td width=\"25\" bgcolor=\"#e0e0e0\" align=\"center\"><b><font color=\"#00000\">".$list0['num']."</font></b></td>\n".
				"<td bgcolor=\"#e0e0e0\"><font color=\"#ff0000\">".$list0['name']."</font></td>\n".
			"</tr></tbody></table>\n".
			"<table width=\"100%\" cellspacing=\"1\" cellpadding=\"2\" border=\"0\"><tbody>".
				"<tr><td align=\"center\" bgcolor=\"#e0e0e0\" width=\"50%\"><b><font color=\"#00000\">Successful Defenses<font></b></td><td align=\"center\" bgcolor=\"#e0e0e0\"><b><font color=\"#00000\">Event</font></b></td></tr>".
				"<tr><td align=\"center\">".$list0['defenses']."</td><td align=\"center\">".$list0['event']."</td></tr>".
				"<tr><td align=\"center\" bgcolor=\"#e0e0e0\"><b><font color=\"#00000\">Reign</font></b></td><td align=\"center\" bgcolor=\"#e0e0e0\"><b><font color=\"#00000\">Date Won</font></b></td></tr>".
				"<tr><td align=\"center\">$days</td><td align=\"center\">".dateConvert($list0['date'])."</td></tr>".
				"<tr><td colspan=\"2\"><i>".$list0['blurb']."</i></td></tr>".
			"</tbody></table>".
			"</td></tr>".
		"</tbody>\n";

	}

}

// Now, determine the longest reign and most defenses
if($longestR != null)
	rsort($longestR);
else
	$longestR[] = "No champion has been decided!";
if($sucessfulD != null)
	rsort($sucessfulD);
else
	$sucessfulD[] = "Title has not been defended!";


//next, we need to assemble the header of the page.
$query = "SELECT *, DATE_FORMAT(`datecreated`, '%M %e, %Y') AS datecreated FROM titlehistory WHERE id='".addslashes($_GET['id'])."' LIMIT 1;";

if ($r = mysql_query ($query)){ // Run the query. 
    	while ($row = mysql_fetch_array ($r)){

		$head .='<table border=0 cellspacing="0" cellpadding=3 width=575>'."\n";
		$head .=	'<tr><td background="images/bg_bar4.gif" height=35> <font color="white">Title Histories</font></td></tr>'."\n";
		$head .=	'<tr><td></td></tr>'."\n";
		$head .='</table>'."\n";
		$head .='<table border=0 cellspacing="0" cellpadding=3 width=575>'."\n";
		$head .=	'<tr><td background="images/bg_bar3.gif" height=35 colspan=2> <font color=black>KOW '.$row['titlename'].'</font></td></tr>'."\n";
		$head .=	'<tr><td width=200><img src="/images/' . $row['titleimage'] . '" width=208px height=156px border=0 alt="View KOW '.$row['titlename'].' History"></td><td valign=top>'."\n";
		$head .=	'<table cellpadding="2" cellspacing="0" border="0" width=100%>'."\n";
		$head .=		'<tr><td align=center bgcolor=#E0E0E0><b><font color="#000000">Date Created</font></b></td></tr><tr><td align=center>'.$row['datecreated'].'</td></tr>'."\n";
		$head .=		'<tr><td bgcolor=#E0E0E0 align=center><b><font color="#000000">Status</font></b></td></tr>'."\n";
		$head .=		'<tr><td align=center>'.$row['status'].'</td></tr>'."\n";
		$head .=		'<tr><td bgcolor=#E0E0E0 align=center><b><font color="#000000">Longest Reign</font></b></td></tr>'."\n";
		$head .=		'<tr><td align=center>'.$longestR[0].'</td></tr>'."\n";
		$head .=		'<tr><td bgcolor=#E0E0E0 align=center><b><font color="#000000">Most Successful Defenses</font></b></td></tr>'."\n";
		$head .=		'<tr><td align=center>'.$sucessfulD[0].'</td></tr>'."\n";
		$head .=	'</table>'."\n";
		$head .='</table>';
	}
}
// Finally, print out all this.
echo $head;
//echo "<hr />";
echo $body;
}
else
{
	print '<table border=0 cellspacing="0" cellpadding=3 width=575>';
	print '<tr><td background="images/bg_bar4.gif" height=35> <font color="white">Title Histories</font></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=4> <font color="#000000">Active Titles</font></td></tr>';
	print '<tr>';

	//Define the query
	$query = "SELECT * FROM titles WHERE status = 'Active'"; // Active rows

	if ($r = mysql_query ($query)){ // Run the query. 

    		while ($row = mysql_fetch_array ($r)){
    
        		print '<td><a href="titlehistory.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></td>';
    	 	}

	} 
	else {
   		 	die ('<p>Could not retrieve the data because <b>' . mysql_error() . '</b>. The query was $query.</p>');
	}//End of query IF 

	print '</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> <font color="#000000">Inactive Titles</font></td></tr>';
	print '<tr>';

	//Define the query
	$query = "SELECT * FROM titles WHERE status = 'Inactive'"; // Inactive Rows

	if ($r = mysql_query ($query)){ // Run the query. 

    		while ($row = mysql_fetch_array ($r)){
    
        		print '<td><a href="titlehistory.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></td>';
    
    	}

	} 
	else {
    		die ('<p>Could not retrieve the data because <b>' . mysql_error() . '</b>. The query was $query.</p>');
	} //End of query IF 
}
print '</tr>';
print '</table>'; 

?>

Link to comment
https://forums.phpfreaks.com/topic/122475-image-not-coded-right/
Share on other sites

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.