Limiting Strings in PHP

Miscellaneous Forums/General Discussion/Limiting Strings in PHP

OK, now I'm having another problem:
http://www.noenemies.com/journal.php

For some reason, it doesn't show any of the journal entries. It is supposed to show a list of journal entries (with the content limited to 200 characters), but it doesn't. And it's not supposed to show the comment box. Here's my PHP code:
<?php
  include_once('header.html');

  if (isset($_REQUEST['view'])) {
    $p_id = $_REQUEST['view'];
  } else {
    $p_id = '';
  }
?>

<div id="content">

<?php

if ($p_id = ''){
  
  $query = "SELECT id, title, content, DATE_FORMAT(date, '%M %d, %Y') AS date FROM journal ORDER BY id DESC";
  $result = mysql_query($query);
  $first = TRUE;
  $num = 0;

  while ($row = @mysql_fetch_array($result, MYSQL_ASSOC)) {
    $num = $num + 1;
    echo '<h1>';
    echo $row['title'];
    echo '</h1>';
    echo '<p><b>[ ';
    echo $row['date'];
    echo ' ] </b></p><p>';
    $content = substr($row['content'],0,200);
    echo $content;
    echo '</p>';
    echo $row['links'];
    echo '<p><b><a href="journal.php?view="';
    echo $row['id'];
    echo '">View Comments</a></b></p>';

    $first = FALSE;
  }

  if ($first) {
    echo 'Nothing here.';
  }
  exit;

} else {

if(isset($_POST['submit'])) {
  $n = $_POST['name'];
  $c = $_POST['comment'];

  $query = "INSERT INTO journalComment (name, comment, date, journalid) VALUES ('$n', '$c', NOW(), '$p_id')";
  $result = @mysql_query($query);
}

  $query = "SELECT title, content FROM journal WHERE id = $p_id";
  $result = @mysql_query($query);
  $row = @mysql_fetch_array($result, MYSQL_ASSOC);
  echo '<h1>';
  echo $row['title'];
  echo '</h1>';
  echo '<p><b>[ ';
  echo $row['date'];
  echo ' ] </b></p><p>';
  echo $row['content'];
  echo '</p>';

  $query = "SELECT name, comment, DATE_FORMAT(date, '%M %d, %Y') AS date FROM journalComment WHERE journalid = $p_id ORDER BY id DESC"; 
  $result = @mysql_query($query);

  echo '<h1>Comments</h1>';
  while($row = @mysql_fetch_array($result, MYSQL_ASSOC)) {
    echo '<p>';
    echo '<i>';
    echo $row['date'];
    echo '</i> - ';
    echo '<b>';
    echo $row['name'];
    echo '</b></p><p>';
    echo $row['comment'];
    echo '</p>';
  }

  ?>
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
  <h2>Add a Comment</h2>
  <p><b>Name</b><br><input type="text" name="name" size="25"></p>
  <p><b>Comment</b><br><textarea rows="8" cols="20"></textarea></p>
  <div align="center"><input type="submit" name="submit" value="Post"></div>
  </form>
  <?php  

} 
?>

</div>

<?php
  include_once('footer.html');
?>