-2

I got this error. Anyone can solve it? Im really need help.

This is the code for view :

<div class="list-group">      
   <?php 
      if($competitionData) {
          $x = 1;
          foreach ($competitionData as $value) { 
      ?>
      <a class="list-group-item classSideBar <?php if($x == 1) { echo 'active'; } ?>" onclick="getcompetitionvenue(<?php echo $value['competition_id'] ?>)" id="competitionId<?php echo $value['competition_id'] ?>">
      <?php echo $value['competition_name']; ?>(<?php echo $value['numeric_name']; ?>)
      </a>  
   <?php 
      $x++;
   }
} else {
   ?>
      <a class="list-group-item">No Data</a>
   <?php
      }   
   ?>
</div>
RAUSHAN KUMAR
  • 5,846
  • 4
  • 34
  • 70
rain
  • 1
  • 1

1 Answers1

0

You haven't set $competitionData you need to initialize it to something first such as $competitionData = true; before you try and use it. Another option would be to replace:

if($competitionData) {

with:

if(isset($competitionData)) {

This should fix your issue.

GrabzIt
  • 41
  • 4
  • in which file that I should implement this? – rain Jun 15 '17 at 13:49
  • I can't say as I am not writing your project but it looks like you should be setting $competitionData to an array as it is trying to output them in HTML. I will update my answer with another option. – GrabzIt Jun 15 '17 at 13:51
  • Please can you mark my answer as the accepted one? – GrabzIt Jun 15 '17 at 14:00