Jump to content

Undefined variable


Xtremer360

Recommended Posts

I had some help righting this query and the extensive coding here and most of it I understand however when i run this it gives me an undefined variable charname error and I'm trying to understand why. Does the coding make sense to anyone?

 

<?php
$query = "SELECT ecm.name AS fighters, ecb.id AS showid, ecm.id AS matchid, ecb.bookingdate AS bookingdate, ecb.event_id AS event_id, els.name AS name, ecb.label AS label FROM `efed_content_appearances` AS eca INNER JOIN `efed_content_matchseg` AS ecm ON eca.content_id = ecm.id INNER JOIN `efed_content_booking` AS ecb ON ecm.booking_id = ecb.id INNER JOIN `efed_list_shownames` AS els ON ecb.event_id = els.id WHERE eca.bio_id = '$id' AND eca.type = 'match' ORDER BY ecb.bookingdate DESC, ecm.sortorder ASC";
$result = mysql_query($query);
if(mysql_num_rows($result) == 0){ echo '<td colspan="3" class="noseg">This wrestler has never been in an event match.</td>' ; }
else{
	$count = 1;
	while($row = mysql_fetch_assoc($result)){
		$fighter = explode(' vs. ', $row['fighters']);
		$opponents = '';
		for($i = 0; $i < count($fighter); $i++){
			if($fighter[$i] != $charname){
				if($opponents != ''){ $opponents .= ', '; }
				$opponents .= $fighter[$i];
			}
		}
		echo '<table cellspacing="0px" style="text-align: center;"><tr class="titlebar"><td>Date</td><td>Show</td><td>Opponent/s</td></tr>';
		echo '<tr class="row' . $count . '"><td>' . convertdate($row['bookingdate']) . '</td><td><a href="content.php?p=results&show=' . $row['event_id'] . '&id=' . $row['showid'] . '#' . $row['matchid'] . '">' . $row['name'] . ' ' . $row['label'] . '</a></td><td>' . $opponents . '</td></tr>';
		echo '</table>';
		if($count == 1){ $count = 2; } else { $count = 1; }
	}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/216655-undefined-variable/
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.