Jump to content

Need help with generating mailing labels - php to pdf script


kahodges

Recommended Posts

I'm using the script at the link below:

http://www.ros.co.nz/pdf/user.php

 

I can get the pdf file to generate, but I'm having trouble figuring out how to get the mysql data to populate into the labels, the arrays, etc..

 

Here is the code I have so far:

<?php
## include the class
include ('class.label.inc');
## connect to the database
$host = 'localhost';
$user = 'myusername';
$password = 'mypassword';

$database = 'mydatabase';
$query = 'select * from employees';
//--------------------------------------------------

// open the connection to the db server
$link = mysql_connect($host,$user,$password);
// change to the right database
mysql_select_db($database);
// do the SQL query
$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');
while($data[] =  mysql_fetch_assoc($result)) {}

## choose a labeltype
$labeltype="Av5160";

## create a new instance of the class of that labeltype
$label= new Clabel($labeltype);

// initialize the array
$data = array();
$info=array(1=>array('line1'=>'employee_name', 'line2'=>'street_address', 'line3'=>'', 'line4'=>'City'.'state'.'zip_code'),);
reset($info); ## just to be sure

## make the labels!
$label->makeLabel($info);
?>

 

I'd really appreciate some help.

 

Thanks.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.