Jump to content


Photo

Undefinded ERROR ? I don't see it -- Please help


  • Please log in to reply
3 replies to this topic

#1 lunac

lunac
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts
  • LocationDulles, VA

Posted 14 June 2006 - 05:25 PM

I'm getting this error "Notice: Undefined variable: l in /Users/dara/Sites/btm/includes/libraries/adminlib.php on line 70"
But I'm not sure what is causing it. I'm passing the $pagelevel into the function on run. The rest are set globally or set with in the function itself. $l is set right there in the while loop. If anyone can figure this out, please help. Thanks.

function checkPagePermissions($pagelevel){ 
    //admin section only
    global $level, $currentmodule, $_tables;
    $thismodule = strtolower(str_replace(" ", "", $currentmodule));
    $y = mysqlSelect($_tables['modules'], "*", "WHERE title = '" . $thismodule . "'");
    while ($yy = @mysql_fetch_assoc($y)){ 
        $l = $level[$yy['level']]; 
    }
    if($l > $pagelevel){
        echo "error";
    } else {
        echo "ok";
    }
}

LunaC
It's a crazy world....

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 14 June 2006 - 05:28 PM

Is line 70 in the code snippet you show? I can't tell. Please indicate which is line 70.

Ken

#3 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 14 June 2006 - 05:29 PM

I'm going to guess that
if($l > $pagelevel){
is line 70 and it's not going through the while loop. Do yourself a favor and set a default value for $l before you fetch the data.

ALSO, get rid of the while loop. If you're only expecting one value, just run the line inside the while logic. Have a statement like that doesn't make any sense whatsoever. You may also want to check that a value was fetched and your result was valid.

Info: PHP Manual


#4 lunac

lunac
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts
  • LocationDulles, VA

Posted 14 June 2006 - 05:37 PM

Forget it, I called the function before the I set $currentmodule. So when it searched the database, it returned nothing. HUGE STUPID ATTACK!

Thanks for the help anyway.

~btw
thanks for the suggest on the while loop. Not sure why I had that. Coding at 1 in the morning, then looking over it the next day ::sigh::

LunaC
It's a crazy world....




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users