...

View Full Version : Resolved function not returning result



sitNsmile
04-02-2010, 12:20 AM
Okay, I am trying to get this function to use the "return" but its not returning any results for the other function to work.


command
$this->checkOrderBy($orderBy);


function;



public function checkOrderBy($orderBy){

switch($orderBy)
{
case 'ID':$order = $this->type0;break;
case 'DATE':$order = $this->type1;break;
case 'RANDOM':$order = $this->type2;break;
case 'RATING':$order = $this->type3;break;
case 'TOTALPOPULAR':$order = $this->type4;break;
case 'TODAYPOPULAR':$order = $this->type5;break;
}

return $order;

}


Thanks, anyone that can help.

Fou-Lu
04-02-2010, 12:31 AM
This may seem daft, but you didn't show this in the actual usage:


$result = $this->checkOrderBy($orderBy);


You are storing the result of $this->checkOrderBy in a variable (or used for output building of sorts) right?


Wait, just noticed you're switch doesn't have a default action for it. I'd always make sure that it has one, $order has to result in something

sitNsmile
04-02-2010, 12:35 AM
This may seem daft, but you didn't show this in the actual usage:


$result = $this->checkOrderBy($orderBy);


You are storing the result of $this->checkOrderBy in a variable (or used for output building of sorts) right?


Wait, just noticed you're switch doesn't have a default action for it. I'd always make sure that it has one, $order has to result in something


ahh thank you. I just realized that, maybe 1 too many redbulls =O

-and I added the default ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum