Re: Printing Fields in Database

From: Date: Mon, 06 Oct 2003 14:08:08 +0000
Subject: Re: Printing Fields in Database
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8297@lists.php.net to get a copy of this message
Roger Spears wrote:
Hello, I'm running Red Hat 9 and Apache. I have a script that stores information in a database. I need to "batch" print specific fields based on the dates they were created. I have recently learned that the printer functions in PHP are for windows machines. I was wondering if anyone out there would care to share how they achieve this? How do you print from a database?
<?php require 'DB.php'; $fp = fopen('/dev/lp0', 'w'); $db = DB::connect('mysql://...'); $res = $db->getAll('SELECT * FROM mytable'); foreach ($res as $row) { fputs($fp, explode(', ', $row) . "\n"); } ?> If you need something more sophisticated I've hear that Agatha Report is able to generate postcript reports from database queries, maybe that helps. Tomas V.V.Cox

« previous php.pear.general (#8297) next »