Xtremer360 Posted October 23, 2010 Share Posted October 23, 2010 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; } } } ?> Quote Link to comment Share on other sites More sharing options...
marcus Posted October 23, 2010 Share Posted October 23, 2010 if($fighter[$i] != $charname){ No where in your code is $charname ever defined. Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted October 23, 2010 Author Share Posted October 23, 2010 Does the coding make sense logically of course. Quote Link to comment Share on other sites More sharing options...
marcus Posted October 23, 2010 Share Posted October 23, 2010 Sure, but what is $charname supposed to be? Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted October 23, 2010 Author Share Posted October 23, 2010 The fighter's name I think. Like I said had that written and kind of understand it and kind of don't. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.