[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.0

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

Asked by eunoiabella in Databases Miscellaneous, MySQL Server, PHP and Databases

Tags: FPDF MYSQL table

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.

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:
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>
Attachments:
 
what the existing input table looks like, copy the basic framework
what the existing input table looks like, copy the basic framework
 
[+][-]07/04/09 10:14 AM, ID: 24777390Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Databases Miscellaneous, MySQL Server, PHP and Databases
Tags: FPDF MYSQL table
Sign Up Now!
Solution Provided By: Ray_Paseur
Participating Experts: 2
Solution Grade: A
 
[+][-]07/04/09 03:50 PM, ID: 24778251Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07/04/09 03:56 PM, ID: 24778268Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/04/09 04:05 PM, ID: 24778288Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/04/09 04:25 PM, ID: 24778350Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/08/09 08:17 PM, ID: 24810507Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/08/09 08:29 PM, ID: 24810559Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/09/09 04:27 AM, ID: 24812461Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/09/09 08:48 AM, ID: 24814941Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/01/09 07:43 AM, ID: 24995519Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]08/01/09 09:11 AM, ID: 24995791Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08/08/09 02:25 AM, ID: 25048948Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20090701_SELECT_ZONES