| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

07-25-07, 13:55
|
|
Registered User
|
|
Join Date: Jul 2007
Posts: 6
|
|
|
Is a "linking" table the answer...?
|
|
I have this huge multi-page form that writes to a database. I then have a pdf generator that will grab data from only some of the questions of the form. Also some of the answers to those questions may be repeated on the pdf form (like name, phone).
What would the best way be for my pdf-generator to get the data from the database?
Thanks!
|
|

07-25-07, 15:30
|
|
King of Understatement
|
|
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
|
|
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
|
|
|

07-25-07, 15:55
|
|
Registered User
|
|
Join Date: Jul 2007
Posts: 6
|
|
|
|
Yes, I am using sql (mysql) and php. I'm just wondering what the best way to accomplish the task would be...
|
|

07-25-07, 17:47
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
|
|
write php code to query the mysql database for the data desired, then use a pdf converter which you can invoke from php to produce the pdfs desired
|
|

07-25-07, 17:55
|
|
Registered User
|
|
Join Date: Jul 2007
Posts: 6
|
|
Quote:
|
Originally Posted by r937
write php code to query the mysql database for the data desired, then use a pdf converter which you can invoke from php to produce the pdfs desired
|
OK, thanks for the response! However, I only want some of the data. The problem is that the data I want is arbitrary. I can't really think of any 'where' or 'limit' clauses to add to the sql statement that would solve the issue.
|
|

07-25-07, 17:56
|
|
King of Understatement
|
|
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
|
|
Quote:
|
Originally Posted by z1freeride
OK, thanks for the response! However, I only want some of the data. The problem is that the data I want is arbitrary. I can't really think of any 'where' or 'limit' clauses to add to the sql statement that would solve the issue.
|
If it is arbitary then why do you need a where clause?
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
|
|
|

07-25-07, 19:16
|
|
Registered User
|
|
Join Date: Jul 2007
Posts: 6
|
|
I need to do something like this then:
select value from table where some_id = 1,5,13,14,15,21,24,26,27. Is there anyway to do that without a bunch of or's (like some_id=1 or some_id=5 or some_id=13, etc)?
|
|

07-25-07, 19:28
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
|
|
where some_id in ( 1,5,13,14,15,21,24,26,27 )
|
|

07-25-07, 19:30
|
|
Registered User
|
|
Join Date: Jul 2007
Posts: 6
|
|
ok I think that's what I'll do! Thanks!
|
|

07-26-07, 13:42
|
|
Registered User
|
|
Join Date: Jul 2007
Posts: 6
|
|
Quote:
|
Originally Posted by r937
where some_id in ( 1,5,13,14,15,21,24,26,27 )
|
Can those list of numbers be a variable in php?
$id_list = "1,5,13";
select some_id from table where some_id in $id_list
??
|
|

07-26-07, 13:50
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
|
|
yes they can but i don't know the exact syntax as i don't speak php
|
|

07-26-07, 13:56
|
|
Village Idiot
|
|
Join Date: Jul 2003
Location: Michigan
Posts: 1,941
|
|
Quote:
|
Originally Posted by pootle flump
I vote for SQL.
|
Now that was a very MOwen-ish answer 
__________________
Inspiration Through Fermentation
|
|

07-26-07, 16:26
|
|
vaguely human
|
|
Join Date: Jun 2007
Location: London
Posts: 2,519
|
|
If it helps ...
Code:
$id_list = "1,5,13";
$sql = "select name, phone from MyTable where id in ( $is_list )";
$result=mysql_query( $sql ) or die( "Issue with " . $sql );
But remember that the $id_list variable must have one or more numbers in it separated by commas.
Mike
|
|

07-26-07, 17:03
|
|
Jaded Developer
|
|
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
|
|
if you are struggling with your PDF generator.. whatever that is, you could write your own PDF file based on your dataset.
I've used PDFLib from http://www.ros.co.nz/pdf with success before.... it can be a bit of a pain at times
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|