lunac Posted June 14, 2006 Share Posted June 14, 2006 I'm getting this error "[b]Notice: Undefined variable: l in [/b][b]/Users/dara/Sites/btm/includes/libraries/adminlib.php[/b] on line [b]70"[/b] 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.[code]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"; }}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11996-undefinded-error-i-dont-see-it-please-help/ Share on other sites More sharing options...
kenrbnsn Posted June 14, 2006 Share Posted June 14, 2006 Is line 70 in the code snippet you show? I can't tell. Please indicate which is line 70.Ken Quote Link to comment https://forums.phpfreaks.com/topic/11996-undefinded-error-i-dont-see-it-please-help/#findComment-45640 Share on other sites More sharing options...
ober Posted June 14, 2006 Share Posted June 14, 2006 I'm going to guess that [code]if($l > $pagelevel){[/code]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. Quote Link to comment https://forums.phpfreaks.com/topic/11996-undefinded-error-i-dont-see-it-please-help/#findComment-45641 Share on other sites More sharing options...
lunac Posted June 14, 2006 Author Share Posted June 14, 2006 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.~btwthanks 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:: Quote Link to comment https://forums.phpfreaks.com/topic/11996-undefinded-error-i-dont-see-it-please-help/#findComment-45643 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.