Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial 
   
    Teacher Russell
16,873 PointsConfused about the instruction.
I made a mess and can't remember what I even started with. Can I get a clue as to where I'm going? Just a hint. Thanks!
<?php
//Available roles: admin, editor, author, subscriber
if (!isset($role)) {
    $role = 'subscriber';
}
//change to switch statement
    switch ($role) {
      case 1 :
        echo 'As an admin, you can add, edit, or delet any post.';
      default:
    echo "You do not have access to this page. Please contact your administrator.";
    }
1 Answer
 
    Jason Anders
Treehouse Moderator 145,862 PointsHi Russell,
You are on the right track 
Here's some hints: :)
- Sometimes PHP doesn't like spaces in certain places. Eg. between switchand the()or the colon after the case.
- You are checking for a case matching the integer on 1? You should be checking for a case with the string "admin"
- After each case, there needs to be a break;.
Now here's the weird thing, when I copy/pasted your code and made the corrections, it still threw an error?!? But when I hand type everything in from start into a fresh challenge, it passes. 
If you are still having issues, have a look at this past post on this question.
Keep Coding! :) 


Teacher Russell
16,873 PointsTeacher Russell
16,873 PointsThat was a mess and a typo. After a rest, and reading your answer carefully, I got did this and passed. Thank you! <?php //Available roles: admin, editor, author, subscriber if (!isset($role)) { $role = 'subscriber'; }
//change to switch statement switch ($role) { case 'admin' : echo 'As an admin, you can add, edit, or delete any post.'; break; default: echo 'You do not have access to this page. Please contact your administrator.'; break; }