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.

 
Go Back  dBforums > General > Database Concepts & Design > Is a "linking" table the answer...?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-25-07, 13:55
z1freeride z1freeride is offline
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!
Reply With Quote
  #2 (permalink)  
Old 07-25-07, 15:30
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
I vote for SQL.
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
  #3 (permalink)  
Old 07-25-07, 15:55
z1freeride z1freeride is offline
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...
Reply With Quote
  #4 (permalink)  
Old 07-25-07, 17:47
r937 r937 is offline
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
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 07-25-07, 17:55
z1freeride z1freeride is offline
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.
Reply With Quote
  #6 (permalink)  
Old 07-25-07, 17:56
pootle flump pootle flump is offline
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.
Reply With Quote
  #7 (permalink)  
Old 07-25-07, 19:16
z1freeride z1freeride is offline
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)?
Reply With Quote
  #8 (permalink)  
Old 07-25-07, 19:28
r937 r937 is offline
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 )
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #9 (permalink)  
Old 07-25-07, 19:30
z1freeride z1freeride is offline
Registered User
 
Join Date: Jul 2007
Posts: 6
ok I think that's what I'll do! Thanks!
Reply With Quote
  #10 (permalink)  
Old 07-26-07, 13:42
z1freeride z1freeride is offline
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

??
Reply With Quote
  #11 (permalink)  
Old 07-26-07, 13:50
r937 r937 is offline
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
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #12 (permalink)  
Old 07-26-07, 13:56
RedNeckGeek RedNeckGeek is offline
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
Reply With Quote
  #13 (permalink)  
Old 07-26-07, 16:26
mike_bike_kite mike_bike_kite is offline
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
Reply With Quote
  #14 (permalink)  
Old 07-26-07, 17:03
healdem healdem is offline
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On