title: Making an image for each line of a mysql row
body: <p>Right now I have this (I'm going to add more once it works, but I wanted to keep it simple for testing)</p>
  
  <pre><code>    &lt;?php
      try {
      $dbh = new PDO('mysql:host= info goes here');
      foreach($dbh-&gt;query('SELECT * from table_name') as $row) {
   header('Content-type: image/jpeg');
    $jpg_image = imagecreatefromjpeg('cert.jpg');
    $white = imagecolorallocate($jpg_image, 255, 255, 255);
    $font_path = 'arial.TTF';
    $text = $row['fname'];
    $font_size = 25;
    imagettftext($jpg_image, $font_size, 0, 500, 100, $white, $font_path, $text);
    imagejpeg($jpg_image);
    imagedestroy($jpg_image);
      }
      $dbh = null;
  } catch (PDOException $e) {
      print "Error!: " . $e-&gt;getMessage() . "&lt;br/&gt;";
      die();
  }
  ?&gt;
  </code></pre>
  
  <p>The code works, but it is only taking the first name, I'm wondering if there is a way to make it so that it will make one for each name (line) until it reaches the end of the row.
  I'm planning on saving one image per name. I'm trying to make something that fills in information on a certificate and saves each one in a folder on the server</p>