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

PHP PHP Basics (Retired) PHP Data & Structure PHP Variables

Hi, My workspace is not working.

I have sent an email to help but did not get an answer.

Please advice. Thanks Paul

The URL I am getting in preview is http://port-80-3484q9qdd0.treehouse-app.

You may want to post your code because those links are not available to others. Remember to use the backtick (on the same button as ~ generally) and format it like so (with line breaks between text and code, and the backticks on their own line):

'''

//PASTE CODE HERE

'''

Do not use the single quote character as I have done. I used the single quote because it resembles the back tick and won't render on the screen as code so I can show you the formatting.

Hi Marcus,

Thanks for your help on this, the issue does not lie in the code in that I launch workspace and hit the preview button from lets say the index file and I just get a blank browser window with the above url in the address bar. I don't touch the code I just want to preview, my inclination is that it should be web in the url and not port-80 but I don't know why it's going to port 80, that's just my theory. Here is the code from the workspace within php Datatypes.

<?php

$name = "Mike";
$location = "Orlando, FL";
$full_name = "Mike The Frog";
$name = $full_name;

?>

<!DOCTYPE html>
<html>
  <head>
    <meta charset=utf-8>
    <title><?php echo $name ?> | Treehouse Profile</title>
    <link href="css/style.css" rel="stylesheet" />
  </head>

  <body>
    <section class="sidebar text-center">
      <div class="avatar">
        <img src="img/avatar.png" alt="<?php echo $name ?>">
      </div>
      <h1><?php echo $name ?></h1>
      <p><?php echo $location?></p>
      <hr />
      <p>Welcome to PHP Basics!</p>
      <hr />
      <ul class="social">
        <li><a href=""><span class="icon twitter"></span></a></li>
      </ul>
    </section>
    <section class="main">
      <p>Let's Get Started!</p>
      <P><?php echo"Hello, World" ?></P>
      <?php
       $greeting = "Hello friends!";
       $greeting{0} = "J';

      ?>

     <ul>
       <li><?php echo $greeting{0}; ?></li>
       <li><?php ;?></li>
       <li></li>
      </ul>
    </section>
  </body>
</html>

2 Answers

Ah, I see, you have an error in your code that is preventing the document from executing properly.

The line:

$greeting{0} = "J';

Should be:

$greeting{0} = "J";

You have a mismatched pair of quotes for the string. After changing that, the PHP executed normally.

Thanks so much Marcus that worked..

Awesome! I'm always glad to help! If you could mark my answer as Best Answer, I would be most appreciative, Paul. :)