title: PHP retrieving content of database
body: <p>I have a database with a few tables in it. The table i'm working on has 6 columns in it,</p>
  
  <p><code>school_id, title, location, content, class_date and user_id</code></p>
  
  <p>The school_id is unique (ranging from 1-20) and there are 4 different user_id (ranging from 1-4).....I'm working on a site which has a table that displays the information about the user and it's correspondence. I have a ReadMore link in the last column of the displayed table, my question is this, when I click the ReadMore link I want it to display the content field in the database based on which event is clicked. </p>
  
  <h2>For the login, the user is asked their user_id as their password.</h2>
  
  <pre><code>//$T is called from a previous page which is the user_id or the password
  $T = $_SESSION["ID"];
  
  
  $INFO= $dbc-&gt;query("SELECT content FROM events where school_id='$T'");
  $a = $INFO-&gt;fetch();
  
  
  $b = $a['content'];
  print_r($b);
  </code></pre>
  
  <p>THE ABOVE CODE IS HOW I TRY TO PRINT OUT THE CORRECT CONTENT BUT ONLY THE FIRST INSTANCE IS PRINTED OUT</p>
  
  <p>THE BELOW CODE IS HOW THE TABLE IS DISPALYED ON MY SITE</p>
  
  <pre><code>&lt;?php
  $gold= $dbc-&gt;query("SELECT * FROM events WHERE user_id='$idcheck' ORDER BY     event_dateLIMIT 10");
      $x = $gold-&gt;fetchAll();
  
      echo "&lt;table border = '1'&gt;";
      echo "&lt;tr&gt;
           &lt;td&gt; Event &lt;/td&gt;
           &lt;td&gt; Date of Event &lt;/td&gt;
           &lt;td&gt; Location &lt;/td&gt;
           &lt;td&gt; Event Information&lt;/td&gt;
           &lt;/tr&gt;";
  
      foreach ($r as $back) {
          $title = $back['title'];
          $eventdate = $back['class_date'];
          $location = $back['location'];
  
          echo "&lt;tr&gt;";
          echo "&lt;td&gt;$title&lt;/td&gt;";
          echo "&lt;td&gt;$eventdate&lt;/td&gt;";
          echo "&lt;td&gt;$location&lt;/td&gt;";
          echo "&lt;td&gt;";
          ?&gt;
  &lt;form action="displaycontent.php" method="post"&gt; 
  
              &lt;input type="submit" value="Read More"&gt;
          &lt;/form&gt;
          &lt;?php
          echo "&lt;/td&gt;";
          echo "&lt;/tr&gt;";
      }
      echo "&lt;/table&gt;";
      ?&gt;
  </code></pre>