Jump to content

T_Variable Error


Xtremer360

Recommended Posts

I can't figure out what's giving me the error. Can anyone else?

 

Parse error: parse error, unexpected T_VARIABLE in /home/content/y/a/n/yankeefaninkc/html/titlehistory6.php on line 97

 

<?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 = "No champions have been crowned yet!";
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=\"100%\" 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";

		$body .= 
		"<table width=\"100%\" cellspacing=\"0\" cellpadding=\"2\" border=\"0\"><tbody>\n".
			"<tr>\n".
			"<td width=\"115\" valign=\"top\" align=\"center\"><img src=\"".$list0['pic']."\" /></td>".
			"<td>".
			"<table width=\"100%\" cellspacing=\"1\" cellpadding=\"2\" border=\"0\"><tbody><tr>".
				"<td width=\"25\" bgcolor=\"#e0e0e0\" align=\"center\"><b>".$list0['num']."</b></td>".
				"<td bgcolor=\"#e0e0e0\"><font color=\"#ff0000\">".$list0['name']."</font></td>".
			"</tr></tbody></table>".
			"<table width=\"100%\" cellspacing=\"1\" cellpadding=\"2\" border=\"0\"><tbody>".
				"<tr><td align=\"center\" bgcolor=\"#e0e0e0\" width=\"50%\"><b>Successful Defenses</b></td><td align=\"center\" bgcolor=\"#e0e0e0\"><b>Event</b></td></tr>".
				"<tr><td align=\"center\">".$list0['defenses']."</td><td align=\"center\">".$list0['event']."</td></tr>".
				"<tr><td align=\"center\" bgcolor=\"#e0e0e0\"><b>Reign</b></td><td align=\"center\" bgcolor=\"#e0e0e0\"><b>Date Won</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></table>\n";

	}

}

// Now, determine the longest reign and most defenses
if($longestR != null)
	rsort($longestR);
else
	$longestR[] = "No champs yet!";
if($sucessfulD != null)
	rsort($sucessfulD);
else
	$sucessfulD[] = "No champs yet!"


//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'])."';";

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


		$head .= '<table border=0 cellspacing="0" cellpadding=3 width=575>';
		$head .='<tr><td background="images/bg_bar4.gif" height=35> <font color="white">Title Histories</font></td></tr>';
		$head .='<tr><td></td></tr>';
		$head .='</table>';
		$head .='<table border=0 cellspacing="0" cellpadding=3 width=575>';
		$head .='<tr><td background="images/bg_bar3.gif" height=35 colspan=2> <font color=black>KOW '.$row['titlename'].'</font></td></tr>';
		$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>';
		$head .='<table cellpadding="2" cellspacing="0" border="0" width=100%>';
		$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>';
		$head .='<tr><td bgcolor=#E0E0E0 align=center><b><font color="#000000">Status</font></b></td></tr>';
		$head .='<tr><td align=center>'.$row['status'].'</td></tr>';
		$head .='<tr><td bgcolor=#E0E0E0 align=center><b><font color="#000000">Longest Reign</font></b></td></tr>';
		$head .='<tr><td align=center>'.$longestR[0].'</td></tr>';
		$head .='<tr><td bgcolor=#E0E0E0 align=center><b><font color="#000000">Most Successful Defenses</font></b></td></tr>';
		$head .='<tr><td align=center>'.$sucessfulD[0].'</td></tr>';
		$head .='</table>';
	}
}
}
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="titlehistory6.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="titlehistory6.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/121456-t_variable-error/
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.