Question

How do I create a table in FPDF pulling data out of MYSQL to fill the cells?

Asked by: eunoiabella

I have a table on a php page that allows entry of data into fields in my database. You can see a picture attached below.The entire table has inputs, meaning the top axis, side axis as well as within the table itself.
The table has a list of the same type of variables along the top (y axis) and another list of the same type of variable along the x axis. The ten inputs along the top of the table are entered into the database called competitors:  c1, c2, c3, c4, c5, c6,c7, c8, c9 and c10.
The variables down the left side are entered into mysql as keywords: k1, k2, k3, k4, k5, k6, k7, k8, k9, k10, respectively.
Each input WITHIN the table is called it's keyword number and d1 along to ten, for example:
the first line of inputs in the table is k1d1, k1d2, k1d3, k1d4, k1d5, k and so on along until k1d10
then the next line WITHIN the table is called k2d1 through to k2d10,
the the third line WITHIN the table has it's input fields k3d1 through to k3d10
fourth line k4d1 going accross until k4d10
and so on, with tenth line down of table having it's inputs within the table as k10d1 going accross to k10d10.
 

I want to recreate the table as it is entered in this table exactly into a pdf in FPDF.
So the table needs to call these inputs from the database and position them in the pdf table in exactly the same way.
How do I do this nicely?

Below you will see code for entering inputs into the table in the php page,
and then a picture of the table form for COLLECTING THESE inputs, which is basically the same framework I want to recreate in the pdf,  
then code for a DIFFERENT existing table I would like to copy the aesthetics of.

This is the code for another existing table in my fpdf. For my new table, I'd like to keep the aesthetics the same as this but present the different information above: 
 
case "indexpagestable":
						$cellwidth = ((PAGEWIDTH - (PAGEMARGIN * 2)) * PDF_SCALING) / 6;
						$fontsize = 14;
						$pdf->SetDrawColor(255, 255, 255);
						$pdf->SetFillColor(192, 80, 77);
						$pdf->SetTextColor(255, 255, 255);
						$pdf->Cell($cellwidth * 2, $fontsize, "", 0, 0, "L");
						$pdf->Cell($cellwidth, $fontsize, "Google", 1, 0, "C", true);
						$pdf->Cell($cellwidth, $fontsize, "Yahoo", 1, 0, "C", true);
						$pdf->Cell($cellwidth, $fontsize, "MSN", 1, 1, "C", true);
						$pdf->SetDrawColor(255, 255, 255);
						$pdf->SetFillColor(223, 167, 167);
						$pdf->SetTextColor(0, 0, 0);
						$pdf->Cell($cellwidth, $fontsize, "", 0, 0, "L");
						$pdf->Cell($cellwidth, 14, "Index Pages", 0, 0, "C");
						$pdf->SetTextColor(255, 255, 255);
						$pdf->Cell($cellwidth, $fontsize, $values["googleindexed"], 1, 0, "C", true);
						$pdf->Cell($cellwidth, $fontsize, $values["yahooindexed"], 1, 0, "C", true);
						$pdf->Cell($cellwidth, $fontsize, $values["msnindexed"], 1, 1, "C", true);
						$pdf->SetDrawColor(0, 0, 0);
						$pdf->SetTextColor(0, 0, 0);
						break;
 
 
 
 
And this is the code for collecting the data into the table: 
    <td >Competitors<br /><br />
    Keywords</td>
    
    <td><input value="<?php echo($_POST['c1']); ?>"  type="text" name="c1" /></td>
    <td><input value="<?php echo($_POST['c2']); ?>"  type="text" name="c2" /></td>
    <td><input value="<?php echo($_POST['c3']); ?>"  type="text" name="c3" /></td>
    <td><input value="<?php echo($_POST['c4']); ?>"  type="text" name="c4" /></td>
    <td><input value="<?php echo($_POST['c5']); ?>"  type="text" name="c5" /></td>
    <td><input value="<?php echo($_POST['c6']); ?>"  type="text" name="c6" /></td>
    <td><input value="<?php echo($_POST['c7']); ?>"  type="text" name="c7" /></td>
    <td><input value="<?php echo($_POST['c8']); ?>"  type="text" name="c8" /></td>
    <td><input value="<?php echo($_POST['c9']); ?>"  type="text" name="c9" /></td>
    <td><input value="<?php echo($_POST['c10']); ?>"  type="text" name="c10" /></td>
    
  </tr>
  
  <tr>
    <td width="50"><input value="<?php echo($_POST['k1']); ?>"  type="text" name="k1" id="k1"/></td>
    
    <td><input value="<?php echo($_POST['k1d1']); ?>"  type="text" name="k1d1" /></td>
    <td><input value="<?php echo($_POST['k1d2']); ?>"  type="text" name="k1d2" /></td>
    <td><input value="<?php echo($_POST['k1d3']); ?>"  type="text" name="k1d3" /></td>
    <td><input value="<?php echo($_POST['k1d4']); ?>"  type="text" name="k1d4" /></td>
    <td><input value="<?php echo($_POST['k1d5']); ?>"  type="text" name="k1d5" /></td>
    <td><input value="<?php echo($_POST['k1d6']); ?>"  type="text" name="k1d6" /></td>
    <td><input value="<?php echo($_POST['k1d7']); ?>"  type="text" name="k1d7" /></td>
    <td><input value="<?php echo($_POST['k1d8']); ?>"  type="text" name="k1d8" /></td>
    <td><input value="<?php echo($_POST['k1d9']); ?>"  type="text" name="k1d9" /></td>
    <td><input value="<?php echo($_POST['k1d10']); ?>"  type="text" name="k1d10" /></td>
    
  </tr>
  <tr>
    <td><input value="<?php echo($_POST['k2']); ?>"  type="text" name="k2" id="k2"/></td>
    
    <td><input value="<?php echo($_POST['k2d1']); ?>"  type="text" name="k2d1" /></td>
    <td><input value="<?php echo($_POST['k2d2']); ?>"  type="text" name="k2d2" /></td>
    <td><input value="<?php echo($_POST['k2d3']); ?>"  type="text" name="k2d3" /></td>
    <td><input value="<?php echo($_POST['k2d4']); ?>"  type="text" name="k2d4" /></td>
    <td><input value="<?php echo($_POST['k2d5']); ?>"  type="text" name="k2d5" /></td>
    <td><input value="<?php echo($_POST['k2d6']); ?>"  type="text" name="k2d6" /></td>
    <td><input value="<?php echo($_POST['k2d7']); ?>"  type="text" name="k2d7" /></td>
    <td><input value="<?php echo($_POST['k2d8']); ?>"  type="text" name="k2d8" /></td>
    <td><input value="<?php echo($_POST['k2d9']); ?>"  type="text" name="k2d9" /></td>
    <td><input value="<?php echo($_POST['k2d10']); ?>"  type="text" name="k2d10" /></td>
    
  </tr>
  <tr>
    <td><input value="<?php echo($_POST['k3']); ?>"  type="text" name="k3" id="k3"/></td>
    
    <td><input value="<?php echo($_POST['k3d1']); ?>"  type="text" name="k3d1" /></td>
    <td><input value="<?php echo($_POST['k3d2']); ?>"  type="text" name="k3d2" /></td>
    <td><input value="<?php echo($_POST['k3d3']); ?>"  type="text" name="k3d3" /></td>
    <td><input value="<?php echo($_POST['k3d4']); ?>"  type="text" name="k3d4" /></td>
    <td><input value="<?php echo($_POST['k3d5']); ?>"  type="text" name="k3d5" /></td>
    <td><input value="<?php echo($_POST['k3d6']); ?>"  type="text" name="k3d6" /></td>
    <td><input value="<?php echo($_POST['k3d7']); ?>"  type="text" name="k3d7" /></td>
    <td><input value="<?php echo($_POST['k3d8']); ?>"  type="text" name="k3d8" /></td>
    <td><input value="<?php echo($_POST['k3d9']); ?>"  type="text" name="k3d9" /></td>
    <td><input value="<?php echo($_POST['k3d10']); ?>"  type="text" name="k3d10" /></td>
    
  </tr>
  <tr>
    <td><input value="<?php echo($_POST['k4']); ?>"  type="text" name="k4" id="k4"/></td>
    
    <td><input value="<?php echo($_POST['k4d1']); ?>"  type="text" name="k4d1" /></td>
    <td><input value="<?php echo($_POST['k4d2']); ?>"  type="text" name="k4d2" /></td>
    <td><input value="<?php echo($_POST['k4d3']); ?>"  type="text" name="k4d3" /></td>
    <td><input value="<?php echo($_POST['k4d4']); ?>"  type="text" name="k4d4" /></td>
    <td><input value="<?php echo($_POST['k4d5']); ?>"  type="text" name="k4d5" /></td>
    <td><input value="<?php echo($_POST['k4d6']); ?>"  type="text" name="k4d6" /></td>
    <td><input value="<?php echo($_POST['k4d7']); ?>"  type="text" name="k4d7" /></td>
    <td><input value="<?php echo($_POST['k4d8']); ?>"  type="text" name="k4d8" /></td>
    <td><input value="<?php echo($_POST['k4d9']); ?>"  type="text" name="k4d9" /></td>
    <td><input value="<?php echo($_POST['k4d10']); ?>"  type="text" name="k4d10" /></td>
    
  </tr>
  <tr>
    <td><input value="<?php echo($_POST['k5']); ?>"  type="text" name="k5" id="k5"/></td>
    
    <td><input value="<?php echo($_POST['k5d1']); ?>"  type="text" name="k5d1" /></td>
    <td><input value="<?php echo($_POST['k5d2']); ?>"  type="text" name="k5d2" /></td>
    <td><input value="<?php echo($_POST['k5d3']); ?>"  type="text" name="k5d3" /></td>
    <td><input value="<?php echo($_POST['k5d4']); ?>"  type="text" name="k5d4" /></td>
    <td><input value="<?php echo($_POST['k5d5']); ?>"  type="text" name="k5d5" /></td>
    <td><input value="<?php echo($_POST['k5d6']); ?>"  type="text" name="k5d6" /></td>
    <td><input value="<?php echo($_POST['k5d7']); ?>"  type="text" name="k5d7" /></td>
    <td><input value="<?php echo($_POST['k5d8']); ?>"  type="text" name="k5d8" /></td>
    <td><input value="<?php echo($_POST['k5d9']); ?>"  type="text" name="k5d9" /></td>
    <td><input value="<?php echo($_POST['k5d10']); ?>"  type="text" name="k5d10" /></td>
    
  </tr>
  <tr>
    <td><input value="<?php echo($_POST['k6']); ?>"  type="text" name="k6" id="k6"/></td>
     
    <td><input value="<?php echo($_POST['k6d1']); ?>"  type="text" name="k6d1" /></td>
    <td><input value="<?php echo($_POST['k6d2']); ?>"  type="text" name="k6d2" /></td>
    <td><input value="<?php echo($_POST['k6d3']); ?>"  type="text" name="k6d3" /></td>
    <td><input value="<?php echo($_POST['k6d4']); ?>"  type="text" name="k6d4" /></td>
    <td><input value="<?php echo($_POST['k6d5']); ?>"  type="text" name="k6d5" /></td>
    <td><input value="<?php echo($_POST['k6d6']); ?>"  type="text" name="k6d6" /></td>
    <td><input value="<?php echo($_POST['k6d7']); ?>"  type="text" name="k6d7" /></td>
    <td><input value="<?php echo($_POST['k6d8']); ?>"  type="text" name="k6d8" /></td>
    <td><input value="<?php echo($_POST['k6d9']); ?>"  type="text" name="k6d9" /></td>
    <td><input value="<?php echo($_POST['k6d10']); ?>"  type="text" name="k6d10" /></td>
   
  </tr>
  <tr>
    <td><input value="<?php echo($_POST['k7']); ?>"  type="text" name="k7" id="k7"/></td>
    
    <td><input value="<?php echo($_POST['k7d1']); ?>"  type="text" name="k7d1" /></td>
    <td><input value="<?php echo($_POST['k7d2']); ?>"  type="text" name="k7d2" /></td>
    <td><input value="<?php echo($_POST['k7d3']); ?>"  type="text" name="k7d3" /></td>
    <td><input value="<?php echo($_POST['k7d4']); ?>"  type="text" name="k7d4" /></td>
    <td><input value="<?php echo($_POST['k7d5']); ?>"  type="text" name="k7d5" /></td>
    <td><input value="<?php echo($_POST['k7d6']); ?>"  type="text" name="k7d6" /></td>
    <td><input value="<?php echo($_POST['k7d7']); ?>"  type="text" name="k7d7" /></td>
    <td><input value="<?php echo($_POST['k7d8']); ?>"  type="text" name="k7d8" /></td>
    <td><input value="<?php echo($_POST['k7d9']); ?>"  type="text" name="k7d9" /></td>
    <td><input value="<?php echo($_POST['k7d10']); ?>"  type="text" name="k7d10" /></td>
    
  </tr>
  <tr>
    <td><input value="<?php echo($_POST['k8']); ?>"  type="text" name="k8" id="k8"/></td>
    
    <td><input value="<?php echo($_POST['k8d1']); ?>"  type="text" name="k8d1" /></td>
    <td><input value="<?php echo($_POST['k8d2']); ?>"  type="text" name="k8d2" /></td>
    <td><input value="<?php echo($_POST['k8d3']); ?>"  type="text" name="k8d3" /></td>
    <td><input value="<?php echo($_POST['k8d4']); ?>"  type="text" name="k8d4" /></td>
    <td><input value="<?php echo($_POST['k8d5']); ?>"  type="text" name="k8d5" /></td>
    <td><input value="<?php echo($_POST['k8d6']); ?>"  type="text" name="k8d6" /></td>
    <td><input value="<?php echo($_POST['k8d7']); ?>"  type="text" name="k8d7" /></td>
    <td><input value="<?php echo($_POST['k8d8']); ?>"  type="text" name="k8d8" /></td>
    <td><input value="<?php echo($_POST['k8d9']); ?>"  type="text" name="k8d9" /></td>
    <td><input value="<?php echo($_POST['k8d10']); ?>"  type="text" name="k8d10" /></td>
    
  </tr>
  <tr>
    <td><input value="<?php echo($_POST['k9']); ?>"  type="text" name="k9" id="k9"/></td>
     
    <td><input value="<?php echo($_POST['k9d1']); ?>"  type="text" name="k9d1" /></td>
    <td><input value="<?php echo($_POST['k9d2']); ?>"  type="text" name="k9d2" /></td>
    <td><input value="<?php echo($_POST['k9d3']); ?>"  type="text" name="k9d3" /></td>
    <td><input value="<?php echo($_POST['k9d4']); ?>"  type="text" name="k9d4" /></td>
    <td><input value="<?php echo($_POST['k9d5']); ?>"  type="text" name="k9d5" /></td>
    <td><input value="<?php echo($_POST['k9d6']); ?>"  type="text" name="k9d6" /></td>
    <td><input value="<?php echo($_POST['k9d7']); ?>"  type="text" name="k9d7" /></td>
    <td><input value="<?php echo($_POST['k9d8']); ?>"  type="text" name="k9d8" /></td>
    <td><input value="<?php echo($_POST['k9d9']); ?>"  type="text" name="k9d9" /></td>
    <td><input value="<?php echo($_POST['k9d10']); ?>"  type="text" name="k9d10" /></td>
   
  </tr>
  <tr>
    <td><input value="<?php echo($_POST['k10']); ?>"  type="text" name="k10" id="k10"/></td>
    
    <td><input value="<?php echo($_POST['k10d1']); ?>"  type="text" name="k10d1" /></td>
    <td><input value="<?php echo($_POST['k10d2']); ?>"  type="text" name="k10d2" /></td>
    <td><input value="<?php echo($_POST['k10d3']); ?>"  type="text" name="k10d3" /></td>
    <td><input value="<?php echo($_POST['k10d4']); ?>"  type="text" name="k10d4" /></td>
    <td><input value="<?php echo($_POST['k10d5']); ?>"  type="text" name="k10d5" /></td>
    <td><input value="<?php echo($_POST['k10d6']); ?>"  type="text" name="k10d6" /></td>
    <td><input value="<?php echo($_POST['k10d7']); ?>"  type="text" name="k10d7" /></td>
    <td><input value="<?php echo($_POST['k10d8']); ?>"  type="text" name="k10d8" /></td>
    <td><input value="<?php echo($_POST['k10d9']); ?>"  type="text" name="k10d9" /></td>
    <td><input value="<?php echo($_POST['k10d10']); ?>"  type="text" name="k10d10" /></td>
    
  </tr>
  
</table>

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:

Select allOpen in new window

  • table.jpg
    • 58 KB

    what the existing input table looks like, copy the basic framework

    what the existing input table looks like, copy the basic framework

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-07-02 at 18:56:09ID24541413
Tags

FPDF MYSQL table

Topics

Databases Miscellaneous

,

MySQL Server

,

PHP and Databases

Participating Experts
2
Points
500
Comments
12

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Bar chart creation using PHP and MySQL
    I would like to produce a bar chart graph showing statisitics as calculated from MySQL database. I have used PHP to create the interface. I would like to get data from MySQL database to produce a bar chart eg.showing the no.of people falling in each particular score interval...
  2. schedule table by PHP and Mysql
    Hello, does anybody advise me how to make schedule table for employees with PHP and mysql? Dates from Mon to Sat are on X axies and employees' names are on Y axies. Each cells contain the starting time and leaving time. Thanks, portal123
  3. php and mySql
    Hiii.....i am learning php, and i am not so god yet....... can somebdy help me with this warning...? Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\xampp\htdocs\DriftsSystem\Oblig\handler\DbHandle...
  4. MySQL & PHP
    Experts, I just installed MySQL and PHP5 on Windows Server 2003. How do I configure PHP to interface with MySql?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: Ray_PaseurPosted on 2009-07-04 at 10:14:23ID: 24777390

Not sure I understand how best to answer this question, but I will try to provide some guidance.  This is a fairly substantial application development project.  Nothing is very "hard" - it is just a lot of code that needs to be written and tested.  The general logic flow would be like this:

1. Query the data base. Get the values for all the fields in the table (if any) from the data base.
2. Present the table in a form to receive client input.  The form fields are prepopulated with whatever you found in the data base.
3. Receive the form in $_POST, validate its contents, handle errors, update the data base with the new client input.
4. Use the validated fields that you have just put into the data base to create the FPDF object.

The look and feel of the table on the client screen is going to be controlled by HTML table, tr, td and styled by CSS.  The look and feel of the PDF file is going to be controlled by your positioning statements that you send to FPDF.  As far as I know there is no generalized way to turn HTML tables and CSS into a set of FPDF commands.

In using FPDF, I have found it useful to use variables or define() constants for all the color numbers and positioning elements.  Since colors are somewhat dependent on the printer, and since you can adjust positions to about 1/100 inch, being able to tinker with these fields is important to getting a good final output.

HTH, ~Ray

 

by: RQuadlingPosted on 2009-07-04 at 15:50:21ID: 24778251

There are several HTML2PDF classes and services around.

Paid for service
http://html2pdf.seven49.net/Web/
http://forum.htm2pdf.co.uk/viewtopic.php?f=4&t=9

Classes
http://html2fpdf.sourceforge.net/
http://www.digitaljunkies.ca/dompdf/index.php

The more complexity the HTML has, the harder it is to convert.

This route is probably easier than manually creating the PDF to match the rendered output.

 

by: Ray_PaseurPosted on 2009-07-04 at 15:56:19ID: 24778268

@RQ: Great idea.

I tried the seven49 link.  Here is my input URL:
http://www.nationalpres.org/

The output is attached here.

Best regards, ~Ray

 

by: RQuadlingPosted on 2009-07-04 at 16:05:32ID: 24778288

Hmm. Overall, not bad. Graphics could be better rendered. It looks like it is quite low res (maybe the paid for service offers a greater quality).

 

by: Ray_PaseurPosted on 2009-07-04 at 16:25:16ID: 24778350

Yes, it got the positioning right.  The JPG-boogers are not so great, but if I used PNG images, that might make the image rendering better.  On this particular site, there are a lot of low-resolution JPG images - artifacts of the day when most of our clients came via slow dial-up lines.

 

by: eunoiabellaPosted on 2009-07-08 at 20:17:10ID: 24810507

Hi Ray and RQuading,
Thanks for your suggestions. The seven49 link is good in theory, however, the problem I have with the is the url I have is one generic one that pulls out entries from my database as I enter...  so how can I differentiate individual records to then convert to pdf?

 

by: eunoiabellaPosted on 2009-07-08 at 20:29:30ID: 24810559

The first picture below shows the process of entry into the database, the code following shows how I am currently calling it, and the second picture shows the pdf table. As you can see it's not quite working properly. The right column of the input table is all the entries that are showing in the pdf and they are on the diagonal instead of a straight line column on the right... Any ideas? How do I get all the inputs show in their right place in the pdf?


case "keywordstable":
                                    $cellwidth = ((PAGEWIDTH - (PAGEMARGIN * 2)) * PDF_SCALING) / 12;
                                    $pdf->Cell($cellwidth * 2, FONTHEIGHT, "Competitors", 0, 0, "L");
                                    for ($i=0; $i<count($values["competitornames"]); $i++)
                                          $pdf->Cell($cellwidth, FONTHEIGHT, $values["competitornames"][$i], 0, 0, "L");

                                    $pdf->ln(FONTHEIGHT);
                                    $pdf->ln(FONTHEIGHT);

                                    foreach ($values["keywords"] as $key => $keyword)
                                    {
                                          $pdf->Cell($cellwidth * 2, FONTHEIGHT, $keyword, 0, 0, "L");
                                          for ($j=0; $j<count($values["competitors"][$key]); $j++)
                                                $pdf->Cell($cellwidth, FONTHEIGHT, $values["competitors"][$key][$i], 0, 0, "C");
                                    }
                                    break;
                              default:
                                    break;

 

by: eunoiabellaPosted on 2009-07-09 at 04:27:57ID: 24812461

Anyone able to help me?.... the url to pdf suggestion wasn't useful because my url stays the same for multiple database records and I need to pull specific tables out of the database....
I'd really love it if someone could help me....
Thanks.

 

by: Ray_PaseurPosted on 2009-07-09 at 08:48:42ID: 24814941

Well, as I said at the top, "This is a fairly substantial application development project" and EE is not well suited to doing application development - we are more of a forum where one can ask and answer questions - designing, writing and debugging program code is often beyond our ability - for that sort of thing a paid developer is what you need.

I recommended FPDF because it has worked for me when I needed to produce PDF files and I had the data available to me in a PHP script.  Richard recommended direct HTML-to-PDF classes as an easier alternative.  But either approach will require considerable time to integrate and debug.  I think we have answered the question and shown you some suitable tools, but we are not really in a position to do the debugging.

Best of luck with it, ~Ray

 

by: Ray_PaseurPosted on 2009-08-01 at 09:11:40ID: 24995791

Split with Richard.  That's my $0.02, ~Ray

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...