Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder sitNsmile's Avatar
    Join Date
    Dec 2009
    Location
    Charlotte, NC
    Posts
    358
    Thanks
    19
    Thanked 2 Times in 2 Posts

    function not returning result

    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
    PHP Code:
    $this->checkOrderBy($orderBy); 

    function;

    PHP Code:
    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.
    Last edited by sitNsmile; 04-02-2010 at 01:44 AM.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    This may seem daft, but you didn't show this in the actual usage:
    PHP Code:
    $result $this->checkOrderBy($orderBy); 
    You are storing the result of $this->checkOrderBy in a variable (or used for output building of sorts) right?

    Edit:
    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
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • Users who have thanked Fou-Lu for this post:

    sitNsmile (04-02-2010)

  • #3
    Regular Coder sitNsmile's Avatar
    Join Date
    Dec 2009
    Location
    Charlotte, NC
    Posts
    358
    Thanks
    19
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Fou-Lu View Post
    This may seem daft, but you didn't show this in the actual usage:
    PHP Code:
    $result $this->checkOrderBy($orderBy); 
    You are storing the result of $this->checkOrderBy in a variable (or used for output building of sorts) right?

    Edit:
    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
    Last edited by sitNsmile; 04-02-2010 at 01:38 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •