Jump to content

Proper syntax "elseif"


adman4054

Recommended Posts

That's right I'm pretty green when it comes to PHP. I googled it, but it looks like there are several ways to achieve this, wondering which is best.

elseif ($subcategory_id == 400)

I want the code to include a number of subcategory_ids, 400, 450, 500, 760, etc.

 

There isn't a range, so what would be the proper way to include multiple category_ids.

 

Thank you

Link to comment
Share on other sites

Thank you requinx for the quick reply. I can use the "in array" in your above code with this:

elseif ($subcategory_id == 400) {
            $this->db->where('number >=', 24);
            $this->db->where('number <=', 27);
            $query = $this->db->get('package');
            if ($query->num_rows() > 0) {
                foreach ($query->result() as $row) {
                    $data[] = $row;
                }
                return $data;
            }
            return array();

Thanks again!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.