undefined

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Message: Undefined index: energy_tech

      Source Code

      1. function get_req($id,$from = '-1',$req = 1){
      2. global $requeriments, $LNG, $USER, $PLANET, $resource, $n;
      3. //See if this item has requirements, if so give it space for the +/-
      4. if(is_array($requeriments[$id])){ $h = 55; }else{ $h = 46; }
      5. //See if we have met this requirement, get curent level
      6. $clevel = ($USER[$resource[$id]] * 1) + ($PLANET[$resource[$id]] * 1);
      7. //Have we beet the requirement?
      8. if($clevel >= $req){
      9. $colour = 'lime';
      10. $req_txt = $req;
      11. }else{
      12. $colour = 'red';
      13. $req_txt = $clevel.'/'.$req;
      14. }
      15. //Add the item to the subtree
      16. $get_req = "\t\t\t\t".'myTree.add('.$n.','.$from.',"<a><img src=\'styles/theme/gow/img/small/small_'.$id.'.jpg\' style=\'border:1px solid '.$colour.';\' /><span class=\'mrtooltip\' style=\'color:'.$colour.'\'>'.$req_txt.' - '.$LNG['tech'][$id].'</span></a>",46,'.$h.');'."\n";
      17. //Note this element then move onto the next.
      18. $from = $n; $n++;
      19. //If there are requirements.
      20. if(is_array($requeriments[$id])){
      21. //Then do the same for each of its requirements.
      22. foreach($requeriments[$id] as $nid => $req){
      23. $get_req .= get_req($nid,$from,$req);
      24. }
      25. }
      26. return $get_req;
      27. }
      Display All

      Source Code

      1. //See if we have met this requirement, get curent level
      2. $clevel = ($USER[$resource[$id]] * 1) + ($PLANET[$resource[$id]] * 1);
    • Problem is here
      1. //See if we have met this requirement, get curent level
      2. $clevel = ($USER[$resource[$id]] * 1) + ($PLANET[$resource[$id]] * 1)


      You try to verify USER['energy_tech'] which doesn't exist, it is just like trying to access $_PLANET['darkmatter'] , that field doesn't exist, for the clevel , try to see if it exists , after do the math. Anyway, as a side note, why do that math calculation ? you have any same column in users and planets ?
      Verify with an isset after everything should be ok.