title: how to use the content-type:image/jpeg properly?
body: <p>I've created a page "student_picture.php" using the content-type:image/jpeg. im having problem when I want to add other text in that same page.. </p>
  
  <p>here is the sample of my code:</p>
  
  <pre><code>&lt;?php
  session_start();
  
  if(!isset($_SESSION["StudentNo"])){
      header("location:login.php");
  }
  
  $StudentNo = $_SESSION['StudentNo'];
  
  require("includes/connection.php");
  
  $sql = "SELECT StudentPicture from dbo.Students where StudentNo = '$StudentNo'";
  $stmt = sqlsrv_query( $conn, $sql );
  
  if( $stmt === false) {
      die( print_r( sqlsrv_errors(), true) );
  }
  
  while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
      $img = $row['StudentPicture'];
  
      if ($img == null ) {
          echo "&lt;img src='img/default_pic.gif'&gt;";
      } else {
          $img =  trim($img);
          header('Content-Type: image/jpeg');
          echo $img;
      }
  
      echo $StudentNo;
  }
  ?&gt;
  </code></pre>
  
  <p>The image is successfully displaying but the echo $StudentNo is not displaying.. can anyone help me with my prob? thanks in advance.</p>