Hi,
I have customer contact information in a MySQL DB. The standard stuff:
first name, last name, city, state, zip, etc.
I'd like to write a PHP script that will take a customer ID range
(e.g., customer 10000 - 11000) and stick those into an MS Word
document, plain text document, or a PDF (any of the three will work).
The key is that each record has to have a page break after it so that
each customer prints on a separate piece of paper.
Anyone know how to do this?
Thanks in advance for any suggestions, links to tutorials, etc. :)
-- Eric 4 11561
Eric Linders wrote: I have customer contact information in a MySQL DB. The standard stuff: first name, last name, city, state, zip, etc.
I'd like to write a PHP script that will take a customer ID range (e.g., customer 10000 - 11000) and stick those into an MS Word document, plain text document, or a PDF (any of the three will work).
The key is that each record has to have a page break after it so that each customer prints on a separate piece of paper.
Anyone know how to do this?
I'd go with the plain text document:
<?php
$txt_file = fopen('textfile.txt', 'wb') or die('Cannot open.');
foreach($dbrecord as $customer) {
$string = 'Name: ' . $customer['name'] . "\r\n";
$string .= 'Address: ' . $customer['address'] . "\r\n";
// ...
$string .= "\x0C\r\n"; ## \x0C is the "form-feed" character
if (!fwrite($txt_file, $string)) die("Unable to write to textfile.txt");
}
fclose($txt_file);
?>
But I have no idea how ms word will interpret the form-feed character.
HTH
--
USENET would be a better place if everybody read: : mail address : http://www.catb.org/~esr/faqs/smart-questions.html : is valid for : http://www.netmeister.org/news/learn2quote2.html : "text/plain" : http://www.expita.com/nomime.html : to 10K bytes :
"Eric Linders" <el********@hotmail.com> wrote in message
news:49**************************@posting.google.c om... Hi,
I have customer contact information in a MySQL DB. The standard stuff: first name, last name, city, state, zip, etc.
I'd like to write a PHP script that will take a customer ID range (e.g., customer 10000 - 11000) and stick those into an MS Word document, plain text document, or a PDF (any of the three will work).
The key is that each record has to have a page break after it so that each customer prints on a separate piece of paper.
Anyone know how to do this?
Thanks in advance for any suggestions, links to tutorials, etc. :) -- Eric
Mmm, go here: http://www.programmershelp.co.uk/phpcreateword.php
HTH
Garp
Pedro Graca <he****@hotpop.com> wrote in message news:<2h************@uni-berlin.de>... Eric Linders wrote:<SNIP>
Anyone know how to do this?
I'd go with the plain text document:
<?php $txt_file = fopen('textfile.txt', 'wb') or die('Cannot open.'); foreach($dbrecord as $customer) { $string = 'Name: ' . $customer['name'] . "\r\n"; $string .= 'Address: ' . $customer['address'] . "\r\n"; // ... $string .= "\x0C\r\n"; ## \x0C is the "form-feed" character if (!fwrite($txt_file, $string)) die("Unable to write to textfile.txt"); } fclose($txt_file); ?>
But I have no idea how ms word will interpret the form-feed character. HTH
Thanks Pedro, I'll try it today! :-) I will let you know how it works out for me.
- Eric
*** Garp wrote/escribió (Thu, 20 May 2004 19:32:58 GMT): Mmm, go here: http://www.programmershelp.co.uk/phpcreateword.php
Please note that you must be running PHP in a Windows server with MS Office
installed for this to work.
As for the PDF option, you have a number of libraries. A free one is: http://www.fpdf.org/
--
--
-- Álvaro G. Vicario - Burgos, Spain
-- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Cleber Hostalácio de Melo |
last post by:
Hi,
I need to change the stop word file used by the MySQL in fulltext seach.
The documentation (www.mysql.com/doc/en/Fulltext_Fine-tuning.html)
explains how to inform to MySQL the new stop...
|
by: Alicia |
last post by:
Does anyone know why I am getting a "Syntax error in Create Table
statement". I am using Microsoft Access SQL View to enter it. Any
other problems I may run into?
CREATE TABLE weeks
(...
|
by: AmitK |
last post by:
is it possible to create a myi, myd file for mysql using a C program. I
am using Stata that is written in C API, and I want to write the data
out to MYSQL database. Using ODBC and loading the data...
|
by: Daniel Walzenbach |
last post by:
Hello,
I want to create a Word XML file based on the input users make in a VB.NET application. I imagine creating a template in Word and saving it as a XML file. I then want to fill the...
|
by: Mikey |
last post by:
Sample VB .NET source code to create mailing labels or customized letters
using MS Word MailMerge
This VB .NET source code will start MS Word and call methods and set
properties in MS Word to...
|
by: Niyazi |
last post by:
Hi,
I created application that store the data in SQL SERVER that reside on
network. The client also use this application to access the resources
provided with application. But is the client want...
|
by: Justin |
last post by:
Hi all, i need some help over here... i found the solution to export
file from mysql db into *.csv. but is there anyway to convert the
contents into *.doc and save in my webserver and providing a...
|
by: ravikiranveluguleti |
last post by:
hi, this is ravikiran
i am working on a project(using java & mysql) that requires creation of a editable mysql file that contains all the data present in a particular table ,(like .mdb file that...
|
by: dbsog7777 |
last post by:
I was trying to use the sample code below, but I encountered two errors:
Application.DoEvents() and AutoText(entry). I am not sure how to correct the errors. I trying to use the sample code to...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |