4 Replies - 537 Views - Last Post: 05 November 2012 - 09:04 AM Rate Topic: -----

#1 don57  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 56
  • Joined: 15-March 12

IF elseif else syntax problem

Posted 05 November 2012 - 08:31 AM

Keep getting an error in the elseif statement. Ideally I want to test for sidebar> 150000 page =1 page > 1 < 7 and page > 5 but I'll be happy just to get it working. The $offset value is just a dummy to test the code.

if (isset($_SESSION['sidebar'])) {

                   switch ($_SESSION['sidebar']) {
                   
                      case 150000: /* 150000 = GodMode */

                         $offset="..\\..\\";
                         
                         break;

                      case 150010: /* 150010 = Fix Master Boot Record */

                         $offset="..\\..\\";

                         break;

                      case 150020: /* 150020 = Repair System Files */

                         $offset="..\\..\\";
                         
                         break;
                   }
                         
}elseif{

                   switch ($_SESSION['page']) {

                      case 1: /* 1 = index.php */

                         $offset="..\\..\\";
                         
                         break;

                      case 5: /* 5 = quick.php */

                         $offset="..\\..\\";
                         
                         break;

                      case 6: /* 6 = quick2.php */

                         $offset="..\\..\\";
                         
                         break;

                     }
}else{

               $offset="..\\";
               
}








Is This A Good Question/Topic? 0
  • +

Replies To: IF elseif else syntax problem

#2 Kruithne  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 99
  • View blog
  • Posts: 442
  • Joined: 28-July 09

Re: IF elseif else syntax problem

Posted 05 November 2012 - 08:38 AM

Hello,

There is nothing in the else if statement.. if what? You're not checking anything for that scope.

if (statement == outcome)
{
	// Code
}
else if (anotherStatement == outcome)
{
	// Code
}
else
{
	// Code
}


As a side note, please don't use so many line breaks, it bloats your code for no reason and makes it annoying to follow.

This post has been edited by Kruithne: 05 November 2012 - 09:04 AM

Was This Post Helpful? 0
  • +
  • -

#3 don57  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 56
  • Joined: 15-March 12

Re: IF elseif else syntax problem

Posted 05 November 2012 - 08:42 AM

Thank You
Was This Post Helpful? 0
  • +
  • -

#4 Sho Ke  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 110
  • View blog
  • Posts: 250
  • Joined: 13-October 11

Re: IF elseif else syntax problem

Posted 05 November 2012 - 09:03 AM

For future reference, PHP doessupport elseif.
Was This Post Helpful? 0
  • +
  • -

#5 Kruithne  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 99
  • View blog
  • Posts: 442
  • Joined: 28-July 09

Re: IF elseif else syntax problem

Posted 05 November 2012 - 09:04 AM

Quote

For future reference, PHP doessupport elseif.


Thanks, post fixed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1