FPDF - printing business cards


#1

I open a dB to retrieve data from 257 records. I wrote code to print business cards on A4 business card stock. The code either prints each card on its own sheet (257 sheets) or I get the first 10 records printed identically on 26 sheets. Help. I need each record printed on its own business card. I think I’m overthinking the problem and making it more difficult than it is. I am using a ‘while’ loop.


#2

Well, this IS a code site… Show some code and the while loop…


#3

Here is the code that generates 1 page of 10 business cards. I need help generating a card for each record, not just 10. Stuck. Help!

<?php

//Open database connection
$username="";$password="";$database="annual_show";
mysql_connect(mysqlcluster23,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM entries ORDER BY `ENTRY_ID` ASC LIMIT 0, 500 ";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
	
require('fpdf.php');
class PDF extends FPDF
{
}
$pdf = new PDF();
$pdf->AddPage('P','A4');

$i=0;

while ($i <= 10)
{

	// COLUMN 1
	//LABEL 1
	$f1=mysql_result($result,$i,"ENTRY_ID");
	$pdf->setFont("Arial","","30");
	$pdf->setXY(15, 13);		
    $pdf->Cell(10, 10, $f1, 0,  0,'L', 0);
    $f2=mysql_result($result,$i,"Class_Number");
    $pdf->setFont("Arial","U","14");            
    $pdf->setXY(37, 10);
	$pdf->Cell(10, 10, "CLS", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14");   
    $pdf->setXY(48, 10);
    $pdf->Cell(10, 10, $f2, 0,  0,'L', 0);
	$f3=mysql_result($result,$i,"Exhibitor_Number");
	$pdf->setFont("Arial","U","14");         
    $pdf->setXY(62, 10);
	$pdf->Cell(10, 10, "XTR", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 
    $pdf->setXY(74, 10);    		
    $pdf->Cell(10, 10, $f3, 0,  0,'L', 0);
	$f4=mysql_result($result,$i,"Exhibit_Number");
	$pdf->setFont("Arial","U","14");        	
	$pdf->setXY(84, 10);
	$pdf->Cell(10, 10, "XBT", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 	
    $pdf->setXY(96, 10);    		
    $pdf->Cell(10, 10, $f4, 0,  0,'L', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(37, 18);		
	$pdf->Cell(10, 10, "Entry", 0, 0, "L", 0);
	$f5=mysql_result($result,$i,"Plant_Name_L1"); 
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(15, 23);		
    $pdf->Cell(90, 10, $f5, 0,  0,'C', 0);
	$f6=mysql_result($result,$i,"Plant_Name_L2");
	$pdf->setXY(15, 28);		
    $pdf->Cell(90, 10, $f6, 0,  0,'C', 0);
	$f7=mysql_result($result,$i,"Plant_Name_L3");
	$pdf->setXY(15, 33);		
    $pdf->Cell(90, 10, $f7, 0,  0,'C', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(37, 38);		
	$pdf->Cell(10, 10, "Cross", 0, 0, "L", 0);	
	$f8=mysql_result($result,$i,"Cross_Name_L1");
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(15, 43);		
    $pdf->Cell(90, 10, $f8, 0,  0,'C', 0);
	$f9=mysql_result($result,$i,"Cross_Name_L2");
	$pdf->setXY(15, 48);		
    $pdf->Cell(90, 10, $f9, 0,  0,'C', 0);
	$f10=mysql_result($result,$i,"Cross_Name_L3");
	$pdf->setXY(15, 53);		
    $pdf->Cell(90, 10, $f10, 0,  0,'C', 0);
    
    //LABEL 2
    $i = ($i + 1);
    $f1=mysql_result($result,$i,"ENTRY_ID");
	$pdf->setFont("Arial","","30");
	$pdf->setXY(15, 64);		
    $pdf->Cell(10, 10, $f1, 0,  0,'L', 0);
    $f2=mysql_result($result,$i,"Class_Number");
    $pdf->setFont("Arial","U","14");            
    $pdf->setXY(37, 61);
	$pdf->Cell(10, 10, "CLS", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14");   
    $pdf->setXY(48, 61);
    $pdf->Cell(10, 10, $f2, 0,  0,'L', 0);
	$f3=mysql_result($result,$i,"Exhibitor_Number");
	$pdf->setFont("Arial","U","14");         
    $pdf->setXY(62, 61);
	$pdf->Cell(10, 10, "XTR", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 
    $pdf->setXY(74, 61);    		
    $pdf->Cell(10, 10, $f3, 0,  0,'L', 0);
	$f4=mysql_result($result,$i,"Exhibit_Number");
	$pdf->setFont("Arial","U","14");        	
	$pdf->setXY(84, 61);
	$pdf->Cell(10, 10, "XBT", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 	
    $pdf->setXY(96, 61);    		
    $pdf->Cell(10, 10, $f4, 0,  0,'L', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(37, 69);		
	$pdf->Cell(10, 10, "Entry", 0, 0, "L", 0);
	$f5=mysql_result($result,$i,"Plant_Name_L1"); 
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(15, 74);		
    $pdf->Cell(90, 10, $f5, 0,  0,'C', 0);
	$f6=mysql_result($result,$i,"Plant_Name_L2");
	$pdf->setXY(15, 79);		
    $pdf->Cell(90, 10, $f6, 0,  0,'C', 0);
	$f7=mysql_result($result,$i,"Plant_Name_L3");
	$pdf->setXY(15, 84);		
    $pdf->Cell(90, 10, $f7, 0,  0,'C', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(37, 89);		
	$pdf->Cell(10, 10, "Cross", 0, 0, "L", 0);	
	$f8=mysql_result($result,$i,"Cross_Name_L1");
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(15, 94);		
    $pdf->Cell(90, 10, $f8, 0,  0,'C', 0);
	$f9=mysql_result($result,$i,"Cross_Name_L2");
	$pdf->setXY(15, 99);		
    $pdf->Cell(90, 10, $f9, 0,  0,'C', 0);
	$f10=mysql_result($result,$i,"Cross_Name_L3");
	$pdf->setXY(15, 104);		
    $pdf->Cell(90, 10, $f10, 0,  0,'C', 0);

	//LABEL 3
	$i = ($i + 2);
	$f1=mysql_result($result,$i,"ENTRY_ID");
	$pdf->setFont("Arial","","30");
	$pdf->setXY(15, 114);		
    $pdf->Cell(10, 10, $f1, 0,  0,'L', 0);
    $f2=mysql_result($result,$i,"Class_Number");
    $pdf->setFont("Arial","U","14");            
    $pdf->setXY(37, 111);
	$pdf->Cell(10, 10, "CLS", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14");   
    $pdf->setXY(48, 111);
    $pdf->Cell(10, 10, $f2, 0,  0,'L', 0);
	$f3=mysql_result($result,$i,"Exhibitor_Number");
	$pdf->setFont("Arial","U","14");         
    $pdf->setXY(62, 111);
	$pdf->Cell(10, 10, "XTR", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 
    $pdf->setXY(74, 111);    		
    $pdf->Cell(10, 10, $f3, 0,  0,'L', 0);
	$f4=mysql_result($result,$i,"Exhibit_Number");
	$pdf->setFont("Arial","U","14");        	
	$pdf->setXY(84, 111);
	$pdf->Cell(10, 10, "XBT", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 	
    $pdf->setXY(96, 111);    		
    $pdf->Cell(10, 10, $f4, 0,  0,'L', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(37, 119);		
	$pdf->Cell(10, 10, "Entry", 0, 0, "L", 0);
	$f5=mysql_result($result,$i,"Plant_Name_L1"); 
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(15, 124);		
    $pdf->Cell(90, 10, $f5, 0,  0,'C', 0);
	$f6=mysql_result($result,$i,"Plant_Name_L2");
	$pdf->setXY(15, 129);		
    $pdf->Cell(90, 10, $f6, 0,  0,'C', 0);
	$f7=mysql_result($result,$i,"Plant_Name_L3");
	$pdf->setXY(15, 134);		
    $pdf->Cell(90, 10, $f7, 0,  0,'C', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(37, 139);		
	$pdf->Cell(10, 10, "Cross", 0, 0, "L", 0);	
	$f8=mysql_result($result,$i,"Cross_Name_L1");
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(15, 144);		
    $pdf->Cell(90, 10, $f8, 0,  0,'C', 0);
	$f9=mysql_result($result,$i,"Cross_Name_L2");
	$pdf->setXY(15, 149);		
    $pdf->Cell(90, 10, $f9, 0,  0,'C', 0);
	$f10=mysql_result($result,$i,"Cross_Name_L3");
	$pdf->setXY(15, 154);		
    $pdf->Cell(90, 10, $f10, 0,  0,'C', 0);

    //LABEL 4
    $i = ($i + 3);
    $f1=mysql_result($result,$i,"ENTRY_ID");
	$pdf->setFont("Arial","","30");
	$pdf->setXY(15, 165);		
    $pdf->Cell(10, 10, $f1, 0,  0,'L', 0);
    $f2=mysql_result($result,$i,"Class_Number");
    $pdf->setFont("Arial","U","14");            
    $pdf->setXY(37, 162);
	$pdf->Cell(10, 10, "CLS", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14");   
    $pdf->setXY(48, 162);
    $pdf->Cell(10, 10, $f2, 0,  0,'L', 0);
	$f3=mysql_result($result,$i,"Exhibitor_Number");
	$pdf->setFont("Arial","U","14");         
    $pdf->setXY(62, 162);
	$pdf->Cell(10, 10, "XTR", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 
    $pdf->setXY(74, 162);    		
    $pdf->Cell(10, 10, $f3, 0,  0,'L', 0);
	$f4=mysql_result($result,$i,"Exhibit_Number");
	$pdf->setFont("Arial","U","14");        	
	$pdf->setXY(84, 162);
	$pdf->Cell(10, 10, "XBT", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 	
    $pdf->setXY(96, 162);    		
    $pdf->Cell(10, 10, $f4, 0,  0,'L', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(37, 170);		
	$pdf->Cell(10, 10, "Entry", 0, 0, "L", 0);
	$f5=mysql_result($result,$i,"Plant_Name_L1"); 
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(15, 175);		
    $pdf->Cell(90, 10, $f5, 0,  0,'C', 0);
	$f6=mysql_result($result,$i,"Plant_Name_L2");
	$pdf->setXY(15, 180);		
    $pdf->Cell(90, 10, $f6, 0,  0,'C', 0);
	$f7=mysql_result($result,$i,"Plant_Name_L3");
	$pdf->setXY(15, 185);		
    $pdf->Cell(90, 10, $f7, 0,  0,'C', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(37, 190);		
	$pdf->Cell(10, 10, "Cross", 0, 0, "L", 0);	
	$f8=mysql_result($result,$i,"Cross_Name_L1");
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(15, 195);		
    $pdf->Cell(90, 10, $f8, 0,  0,'C', 0);
	$f9=mysql_result($result,$i,"Cross_Name_L2");
	$pdf->setXY(15, 200);		
    $pdf->Cell(90, 10, $f9, 0,  0,'C', 0);
	$f10=mysql_result($result,$i,"Cross_Name_L3");
	$pdf->setXY(15, 205);		
    $pdf->Cell(90, 10, $f10, 0,  0,'C', 0);

	//LABEL 5
	$i = ($i + 4);
	$f1=mysql_result($result,$i,"ENTRY_ID");
	$pdf->setFont("Arial","","30");
	$pdf->setXY(15, 216);		
    $pdf->Cell(10, 10, $f1, 0,  0,'L', 0);
    $f2=mysql_result($result,$i,"Class_Number");
    $pdf->setFont("Arial","U","14");            
    $pdf->setXY(37, 213);
	$pdf->Cell(10, 10, "CLS", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14");   
    $pdf->setXY(48, 213);
    $pdf->Cell(10, 10, $f2, 0,  0,'L', 0);
	$f3=mysql_result($result,$i,"Exhibitor_Number");
	$pdf->setFont("Arial","U","14");         
    $pdf->setXY(62, 213);
	$pdf->Cell(10, 10, "XTR", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 
    $pdf->setXY(74, 213);    		
    $pdf->Cell(10, 10, $f3, 0,  0,'L', 0);
	$f4=mysql_result($result,$i,"Exhibit_Number");
	$pdf->setFont("Arial","U","14");        	
	$pdf->setXY(84, 213);
	$pdf->Cell(10, 10, "XBT", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 	
    $pdf->setXY(96, 213);    		
    $pdf->Cell(10, 10, $f4, 0,  0,'L', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(37, 221);		
	$pdf->Cell(10, 10, "Entry", 0, 0, "L", 0);
	$f5=mysql_result($result,$i,"Plant_Name_L1"); 
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(15, 226);		
    $pdf->Cell(90, 10, $f5, 0,  0,'C', 0);
	$f6=mysql_result($result,$i,"Plant_Name_L2");
	$pdf->setXY(15, 231);		
    $pdf->Cell(90, 10, $f6, 0,  0,'C', 0);
	$f7=mysql_result($result,$i,"Plant_Name_L3");
	$pdf->setXY(15, 236);		
    $pdf->Cell(90, 10, $f7, 0,  0,'C', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(37, 241);		
	$pdf->Cell(10, 10, "Cross", 0, 0, "L", 0);	
	$f8=mysql_result($result,$i,"Cross_Name_L1");
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(15, 246);		
    $pdf->Cell(90, 10, $f8, 0,  0,'C', 0);
	$f9=mysql_result($result,$i,"Cross_Name_L2");
	$pdf->setXY(15, 251);		
    $pdf->Cell(90, 10, $f9, 0,  0,'C', 0);
	$f10=mysql_result($result,$i,"Cross_Name_L3");
	$pdf->setXY(15, 256);		
    $pdf->Cell(90, 10, $f10, 0,  0,'C', 0);

	//COLUMN 2
	//LABEL 6
	$i = ($i + 5);
	$f1=mysql_result($result,$i,"ENTRY_ID");
	$pdf->setFont("Arial","","30");
	$pdf->setXY(103, 13);		
    $pdf->Cell(10, 10, $f1, 0,  0,'L', 0);
    $f2=mysql_result($result,$i,"Class_Number");
    $pdf->setFont("Arial","U","14");            
    $pdf->setXY(125, 10);
	$pdf->Cell(10, 10, "CLS", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14");   
    $pdf->setXY(136, 10);
    $pdf->Cell(10, 10, $f2, 0,  0,'L', 0);
	$f3=mysql_result($result,$i,"Exhibitor_Number");
	$pdf->setFont("Arial","U","14");         
    $pdf->setXY(150, 10);
	$pdf->Cell(10, 10, "XTR", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 
    $pdf->setXY(162, 10);    		
    $pdf->Cell(10, 10, $f3, 0,  0,'L', 0);
	$f4=mysql_result($result,$i,"Exhibit_Number");
	$pdf->setFont("Arial","U","14");        	
	$pdf->setXY(172, 10);
	$pdf->Cell(10, 10, "XBT", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 	
    $pdf->setXY(184, 10);    		
    $pdf->Cell(10, 10, $f4, 0,  0,'L', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(125, 18);		
	$pdf->Cell(10, 10, "Entry", 0, 0, "L", 0);
	$f5=mysql_result($result,$i,"Plant_Name_L1"); 
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(103, 23);		
    $pdf->Cell(90, 10, $f5, 0,  0,'C', 0);
	$f6=mysql_result($result,$i,"Plant_Name_L2");
	$pdf->setXY(103, 28);		
    $pdf->Cell(90, 10, $f6, 0,  0,'C', 0);
	$f7=mysql_result($result,$i,"Plant_Name_L3");
	$pdf->setXY(103, 33);		
    $pdf->Cell(90, 10, $f7, 0,  0,'C', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(125, 38);		
	$pdf->Cell(10, 10, "Cross", 0, 0, "L", 0);	
	$f8=mysql_result($result,$i,"Cross_Name_L1");
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(103, 43);		
    $pdf->Cell(90, 10, $f8, 0,  0,'C', 0);
	$f9=mysql_result($result,$i,"Cross_Name_L2");
	$pdf->setXY(103, 48);		
    $pdf->Cell(90, 10, $f9, 0,  0,'C', 0);
	$f10=mysql_result($result,$i,"Cross_Name_L3");
	$pdf->setXY(103, 53);		
    $pdf->Cell(90, 10, $f10, 0,  0,'C', 0);

     //LABEL 7
	$i = ($i + 6);
	$f1=mysql_result($result,$i,"ENTRY_ID");
	$pdf->setFont("Arial","","30");
	$pdf->setXY(103, 64);		
    $pdf->Cell(10, 10, $f1, 0,  0,'L', 0);
    $f2=mysql_result($result,$i,"Class_Number");
    $pdf->setFont("Arial","U","14");            
    $pdf->setXY(125, 61);
	$pdf->Cell(10, 10, "CLS", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14");   
    $pdf->setXY(136, 61);
    $pdf->Cell(10, 10, $f2, 0,  0,'L', 0);
	$f3=mysql_result($result,$i,"Exhibitor_Number");
	$pdf->setFont("Arial","U","14");         
    $pdf->setXY(150, 61);
	$pdf->Cell(10, 10, "XTR", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 
    $pdf->setXY(162, 61);    		
    $pdf->Cell(10, 10, $f3, 0,  0,'L', 0);
	$f4=mysql_result($result,$i,"Exhibit_Number");
	$pdf->setFont("Arial","U","14");        	
	$pdf->setXY(172, 61);
	$pdf->Cell(10, 10, "XBT", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 	
    $pdf->setXY(184, 61);    		
    $pdf->Cell(10, 10, $f4, 0,  0,'L', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(125, 69);		
	$pdf->Cell(10, 10, "Entry", 0, 0, "L", 0);
	$f5=mysql_result($result,$i,"Plant_Name_L1"); 
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(103, 74);		
    $pdf->Cell(90, 10, $f5, 0,  0,'C', 0);
	$f6=mysql_result($result,$i,"Plant_Name_L2");
	$pdf->setXY(103, 79);		
    $pdf->Cell(90, 10, $f6, 0,  0,'C', 0);
	$f7=mysql_result($result,$i,"Plant_Name_L3");
	$pdf->setXY(103, 84);		
    $pdf->Cell(90, 10, $f7, 0,  0,'C', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(125, 89);		
	$pdf->Cell(10, 10, "Cross", 0, 0, "L", 0);	
	$f8=mysql_result($result,$i,"Cross_Name_L1");
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(103, 94);		
    $pdf->Cell(90, 10, $f8, 0,  0,'C', 0);
	$f9=mysql_result($result,$i,"Cross_Name_L2");
	$pdf->setXY(103, 99);		
    $pdf->Cell(90, 10, $f9, 0,  0,'C', 0);
	$f10=mysql_result($result,$i,"Cross_Name_L3");
	$pdf->setXY(103, 104);		
    $pdf->Cell(90, 10, $f10, 0,  0,'C', 0);

	//LABEL 8
	$i = ($i + 7);
	$f1=mysql_result($result,$i,"ENTRY_ID");
	$pdf->setFont("Arial","","30");
	$pdf->setXY(103, 114);		
    $pdf->Cell(10, 10, $f1, 0,  0,'L', 0);
    $f2=mysql_result($result,$i,"Class_Number");
    $pdf->setFont("Arial","U","14");            
    $pdf->setXY(125, 111);
	$pdf->Cell(10, 10, "CLS", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14");   
    $pdf->setXY(136, 111);
    $pdf->Cell(10, 10, $f2, 0,  0,'L', 0);
	$f3=mysql_result($result,$i,"Exhibitor_Number");
	$pdf->setFont("Arial","U","14");         
    $pdf->setXY(150, 111);
	$pdf->Cell(10, 10, "XTR", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 
    $pdf->setXY(162, 111);    		
    $pdf->Cell(10, 10, $f3, 0,  0,'L', 0);
	$f4=mysql_result($result,$i,"Exhibit_Number");
	$pdf->setFont("Arial","U","14");        	
	$pdf->setXY(172, 111);
	$pdf->Cell(10, 10, "XBT", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 	
    $pdf->setXY(184, 111);    		
    $pdf->Cell(10, 10, $f4, 0,  0,'L', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(125, 119);		
	$pdf->Cell(10, 10, "Entry", 0, 0, "L", 0);
	$f5=mysql_result($result,$i,"Plant_Name_L1"); 
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(103, 124);		
    $pdf->Cell(90, 10, $f5, 0,  0,'C', 0);
	$f6=mysql_result($result,$i,"Plant_Name_L2");
	$pdf->setXY(103, 129);		
    $pdf->Cell(90, 10, $f6, 0,  0,'C', 0);
	$f7=mysql_result($result,$i,"Plant_Name_L3");
	$pdf->setXY(103, 134);		
    $pdf->Cell(90, 10, $f7, 0,  0,'C', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(125, 139);		
	$pdf->Cell(10, 10, "Cross", 0, 0, "L", 0);	
	$f8=mysql_result($result,$i,"Cross_Name_L1");
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(103, 144);		
    $pdf->Cell(90, 10, $f8, 0,  0,'C', 0);
	$f9=mysql_result($result,$i,"Cross_Name_L2");
	$pdf->setXY(103, 149);		
    $pdf->Cell(90, 10, $f9, 0,  0,'C', 0);
	$f10=mysql_result($result,$i,"Cross_Name_L3");
	$pdf->setXY(103, 154);		
    $pdf->Cell(90, 10, $f10, 0,  0,'C', 0);

	//LABEL 9
	$i = ($i + 8);
	$f1=mysql_result($result,$i,"ENTRY_ID");
	$pdf->setFont("Arial","","30");
	$pdf->setXY(103, 165);		
    $pdf->Cell(10, 10, $f1, 0,  0,'L', 0);
    $f2=mysql_result($result,$i,"Class_Number");
    $pdf->setFont("Arial","U","14");            
    $pdf->setXY(125, 162);
	$pdf->Cell(10, 10, "CLS", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14");   
    $pdf->setXY(136, 162);
    $pdf->Cell(10, 10, $f2, 0,  0,'L', 0);
	$f3=mysql_result($result,$i,"Exhibitor_Number");
	$pdf->setFont("Arial","U","14");         
    $pdf->setXY(150, 162);
	$pdf->Cell(10, 10, "XTR", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 
    $pdf->setXY(162, 162);    		
    $pdf->Cell(10, 10, $f3, 0,  0,'L', 0);
	$f4=mysql_result($result,$i,"Exhibit_Number");
	$pdf->setFont("Arial","U","14");        	
	$pdf->setXY(172, 162);
	$pdf->Cell(10, 10, "XBT", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 	
    $pdf->setXY(184, 162);    		
    $pdf->Cell(10, 10, $f4, 0,  0,'L', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(125, 170);		
	$pdf->Cell(10, 10, "Entry", 0, 0, "L", 0);
	$f5=mysql_result($result,$i,"Plant_Name_L1"); 
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(103, 175);		
    $pdf->Cell(90, 10, $f5, 0,  0,'C', 0);
	$f6=mysql_result($result,$i,"Plant_Name_L2");
	$pdf->setXY(103, 180);		
    $pdf->Cell(90, 10, $f6, 0,  0,'C', 0);
	$f7=mysql_result($result,$i,"Plant_Name_L3");
	$pdf->setXY(103, 185);		
    $pdf->Cell(90, 10, $f7, 0,  0,'C', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(125, 190);		
	$pdf->Cell(10, 10, "Cross", 0, 0, "L", 0);	
	$f8=mysql_result($result,$i,"Cross_Name_L1");
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(103, 195);		
    $pdf->Cell(90, 10, $f8, 0,  0,'C', 0);
	$f9=mysql_result($result,$i,"Cross_Name_L2");
	$pdf->setXY(103, 200);		
    $pdf->Cell(90, 10, $f9, 0,  0,'C', 0);
	$f10=mysql_result($result,$i,"Cross_Name_L3");
	$pdf->setXY(103, 205);		
    $pdf->Cell(90, 10, $f10, 0,  0,'C', 0);

	//LABEL 10
	$i = ($i + 9);
	$f1=mysql_result($result,$i,"ENTRY_ID");
	$pdf->setFont("Arial","","30");
	$pdf->setXY(103, 216);		
    $pdf->Cell(10, 10, $f1, 0,  0,'L', 0);
    $f2=mysql_result($result,$i,"Class_Number");
    $pdf->setFont("Arial","U","14");            
    $pdf->setXY(125, 213);
	$pdf->Cell(10, 10, "CLS", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14");   
    $pdf->setXY(136, 213);
    $pdf->Cell(10, 10, $f2, 0,  0,'L', 0);
	$f3=mysql_result($result,$i,"Exhibitor_Number");
	$pdf->setFont("Arial","U","14");         
    $pdf->setXY(150, 213);
	$pdf->Cell(10, 10, "XTR", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 
    $pdf->setXY(162, 213);    		
    $pdf->Cell(10, 10, $f3, 0,  0,'L', 0);
	$f4=mysql_result($result,$i,"Exhibit_Number");
	$pdf->setFont("Arial","U","14");        	
	$pdf->setXY(172, 213);
	$pdf->Cell(10, 10, "XBT", 0, 0, "L", 0);
	$pdf->setFont("Arial","","14"); 	
    $pdf->setXY(184, 213);    		
    $pdf->Cell(10, 10, $f4, 0,  0,'L', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(125, 221);		
	$pdf->Cell(10, 10, "Entry", 0, 0, "L", 0);
	$f5=mysql_result($result,$i,"Plant_Name_L1"); 
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(103, 226);		
    $pdf->Cell(90, 10, $f5, 0,  0,'C', 0);
	$f6=mysql_result($result,$i,"Plant_Name_L2");
	$pdf->setXY(103, 231);		
    $pdf->Cell(90, 10, $f6, 0,  0,'C', 0);
	$f7=mysql_result($result,$i,"Plant_Name_L3");
	$pdf->setXY(103, 236);		
    $pdf->Cell(90, 10, $f7, 0,  0,'C', 0);
	$pdf->setFont("Arial","U","10");            
	$pdf->setXY(125, 241);		
	$pdf->Cell(10, 10, "Cross", 0, 0, "L", 0);	
	$f8=mysql_result($result,$i,"Cross_Name_L1");
	$pdf->setFont("Arial","","12");            
	$pdf->setXY(103, 246);		
    $pdf->Cell(90, 10, $f8, 0,  0,'C', 0);
	$f9=mysql_result($result,$i,"Cross_Name_L2");
	$pdf->setXY(103, 251);		
    $pdf->Cell(90, 10, $f9, 0,  0,'C', 0);
	$f10=mysql_result($result,$i,"Cross_Name_L3");
	$pdf->setXY(103, 256);		
    $pdf->Cell(90, 10, $f10, 0,  0,'C', 0);	
	
	$i++;
	

	$pdf->AddPage();
	}
	

	
	$pdf->Output();

	


	
		  
?>

#4

Okay, the code you show is hard coding each label. You just need to hard-code the label once and use
code to alter the positioning and the cols, etc. We can help you do this, but…

First, no programmer here will write MySQL code. It is no longer used and is not even in the newest versions of PHP. You need to move up to MySQLi (improved version) OR even better PDO. And, you should use prepared-statements to protect your site from hackers.

Next, do you need this to be a PDF? You could simply use

tags and set up the page to have the 10 cards per page.

This would be easier, I think. But, you can do it with a PDF and the FPDF library. You would just need to
alter the positioning commands to be programmed, not hard-coded. Also, you would need to add a new page after it fills out the current page. So, you are creating a set of 10 cards per page. And, using SETXY to position various parts of the card inside the correct area of the page. You would need to change these settings using a base number. Looking at your listing, I could not understand the layout your are using.

You would need to set a base for X and Y and then adjust these for each row and col of the cards.
So, card number 1 would be started at the smallest X/Y. Then, as you move to card 2, you would just adjust
the col Y value. Then, when you move down a row, you would add a number for each row. And, for each
part of one card, you would adjust the base values. I would guess something like below would work for you.
But, I can’t test it for a couple days for you. But, you might get the idea from it…

require('fpdf.php');
class PDF extends FPDF { }
$pdf = new PDF();

//  Set first label's position
$label = 1;

//  Move thru all cards
while ($row=mysql_fetch_assoc($result)) {
    //  $row contains data for each card to be set up
    //  First check if this is the first of 10 cards, if so, add new page
    if ($label==1) { $pdf->AddPage('P','A4'); }

    //  If label number is odd it's on left, even on right, adjust as needed
    //  Also set up row number for card using simple math
    $current_y = 10;
    if ($label % 2 == 0) { $current_y = 61; }
    //  Also set up row number for card using simple math
    $current_x = 15+(103*($label/2));     //  2 per row means 5 down, so 10/2 would give 1 to 5

    //  Process card
    $pdf->setFont("Arial","","30");
    $pdf->setXY($current_x, $current_y+3);	
    $pdf->Cell(10, 10, $row["ENTRY_ID"], 0,  0,'L', 0);
    $pdf->setFont("Arial","U","14"); 
    $pdf->setXY($current_x+22, $current_y);
    $pdf->Cell(10, 10, "CLS", 0, 0, "L", 0);
    $pdf->setFont("Arial","","14");   
    $pdf->setXY($current_x+33, $current_y);
    $pdf->Cell(10, 10, $row["Class_Number"], 0,  0,'L', 0);
    $pdf->setFont("Arial","U","14");         
    $pdf->setXY($current_x+47, $current_y);
    $pdf->Cell(10, 10, "XTR", 0, 0, "L", 0);
    $pdf->setFont("Arial","","14"); 
    $pdf->setXY($current_x+59, $current_y);
    $pdf->Cell(10, 10, $row["Exhibitor_Number"], 0,  0,'L', 0);
    $pdf->setFont("Arial","U","14");        	
    $pdf->setXY($current_x+69, $current_y);
    $pdf->Cell(10, 10, "XBT", 0, 0, "L", 0);
    $pdf->setFont("Arial","","14"); 	
    $pdf->setXY($current_x+81, $current_y);
    $pdf->Cell(10, 10, $row["Exhibit_Number"], 0,  0,'L', 0);
    $pdf->setFont("Arial","U","10");            
    $pdf->setXY($current_x+22, $current_y+8);
    $pdf->Cell(10, 10, "Entry", 0, 0, "L", 0); 
    $pdf->setFont("Arial","","12");            
    $pdf->setXY($current_x, $current_y+13);
    $pdf->Cell(90, 10, $row["Plant_Name_L1"], 0,  0,'C', 0);
    $pdf->setXY($current_x, $current_y+18);
    $pdf->Cell(90, 10, $row["Plant_Name_L2"], 0,  0,'C', 0);
    $pdf->setXY($current_x, $current_y+23);
    $pdf->Cell(90, 10, $row["Plant_Name_L3"], 0,  0,'C', 0);
    $pdf->setFont("Arial","U","10");            
    $pdf->setXY($current_x+22, $current_y+28);
    $pdf->Cell(10, 10, "Cross", 0, 0, "L", 0);	
    $pdf->setFont("Arial","","12");            
    $pdf->setXY($current_x, $current_y+33);
    $pdf->Cell(90, 10, $row["Cross_Name_L1"], 0,  0,'C', 0);
    $pdf->setXY($current_x, $current_y+38);
    $pdf->Cell(90, 10, $row["Cross_Name_L2"], 0,  0,'C', 0);
    $pdf->setXY($current_x, $current_y+43);
    $pdf->Cell(90, 10, $row["Cross_Name_L3"], 0,  0,'C', 0);
    
    //  Increment the label counter, but, if over 10 reset to 1
    $label = $label+1;
    if($label==11) { $label = 1; }
}