Printing mailing labels - php, MySQL, FPDF
<p>I'm having trouble getting this script to output a pdf for mailing labels. It throws this error:
Parse error: syntax error, unexpected $end </p>

<pre><code>&lt;?php
define('FPDF_FONTPATH','/home/directory/public_html/sub/font/');
require_once('fpdf.php');
//Connect to your database
mysql_connect("localhost", "db_user","db_pw") or
    die ("Could not connect to database");
mysql_select_db("database_name") or
    die ("Could not select database");

$query  = "SELECT employee_name, street_address, City, state, zip_code FROM employees ORDER BY `employee_name` ";
$result = mysql_query($query) or die('Error, query failed');
$num_rows = mysql_num_rows($result);

function PrintAddressLabels($result){ 


  $pdf=new FPDF(); 

  $pdf-&gt;Open();
  $pdf-&gt;AddPage(); 
  $pdf-&gt;SetFont('Arial','B',14);
  $pdf-&gt;SetMargins(0,0); 
  $pdf-&gt;SetAutoPageBreak(false); 
  $x = 0;
  $y = 0;
  $i=0;

  while (TRUE) {

    if ($row=$result[$i]) {

      //positions set above 
      $LabelText = sprintf("%s\n%s %s\n%s, %s, %s", 
      $row['employee_name'],
      $row['street_address'],
      $row['City'],
      $row['state'],
      $row['zip_code']);


      Avery5160($x,$y,&amp;$pdf,$LabelText);

      $y++; // next row 
      if ($y == 10 ) { // end of page wrap to next column 
        $x++; 
        $y = 0; 
        if ($x == 3 ) { // end of page 
          $x = 0; 
          $y = 0; 
          $pdf-&gt;AddPage(); 
        }
      }
      $i++; //counter through result
    } else {
      // Error quit printing 
      break; 
    }

  {
  $pdf-&gt;Output('mailing_labels.pdf','D');
}
?&gt;
</code></pre>
