I have an admin panel that each section contains a set of tools so on each
page I can set $toolsneeded = "admin" or $toolsneeded = "employees"; etc.
I keep recieving this error:
Warning: Division by zero in /home/www/website/admin/include/adminclass.php
on line 250
Warning: Variable passed to each() is not an array or object in
/home/www/website/admin/include/adminclass.php on line 251
This is line 250: $height = 100/count($tools);
Here is the page that uses the class.
SetContent($redux);
$toolsneeded = "admin";
$adminroot->SetTools($toolsneeded);
$adminroot->Display($employeeid,$password,$title);
?>
Here is my class file with some of the functions removed for brevity. I have
real problems understanding $this-> so you may find that Im using it in the
wrong place or not using it where I should be.
"orders_root.php",
"products" => "products_root.php"
);
##
##SET FUNCTIONS
##
function SetContent($newContent)
{
$this->content = $newContent;
}
function SetTools($newTools)
{
$this->toolsneeded = $newTools;
}
##
##DISPLAY FUNCTION
##
function Display($employeeid,$password,$title)
{
session_start();
session_register("employeeid");
$count = $this -> VerifyLogin($employeeid,$password);
switch($count)
{
case "1":
$this -> DisplayHeader($title,$employeeid);
echo "";
$this -> DisplayMenu($this->buttons);
echo "";
$this -> DisplayContent($this->tools,$this->content);
echo "";
$this -> DisplayFooter();
break;
default:
$title = "Please Try Again";
$employeeid = "";
$this -> DisplayHeader($title,$employeeid);
echo "";
echo "Your username and password combination is incorrect. Please try
again.";
$this -> DisplayLogInForm();
echo "";
$this -> DisplayFooter();
break;
}
}
##
##DISPLAY TOOLS FUNCTION
##
function DisplayTools($tools)
{
echo "";
echo "";
echo"";
echo"";
###
###Line 250
###
$height = 100/count($tools);
###
###
while(list($name,$url) = each($tools))
{
$this ->ToolsLayout($height,$name,$url);
}
echo "";
echo "";
echo "";
echo "";
}
##
##TOOLS LAYOUT FUNCTION
##
function ToolsLayout($height,$name,$url)
{
echo "";
echo "[ $name ]";
}
function ToolSelected($toolsneeded)
{
switch($toolsneeded)
{
case "admin":
DisplayTools($toolsadmin);
break;
case "orders":
echo "Order Tools";
break;
default:
echo "Your Tools do not work";
}
}
##
##DISPLAY CONTENT FUNCTION
##
function DisplayContent($toolsneeded,$content)
{
?>
DisplayTools($toolsneeded);
?>
admin
a and i balancing administration
http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php