Blobbing PDF with conditions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Micah_geek
Forum Newbie
Posts: 1
Joined: Sat Jan 08, 2005 10:58 am

Blobbing PDF with conditions

Post by Micah_geek »

I have a database schema like so,
DATE - a date formatted by date('Ymd')
TITLE - The name of the PDF
file - a blob for the PDF

I run a group, and I would like to provide the lessons on my site. I can only post 1 lesson, so I need a way to check that it was the latest lesson. What I have done is have two frames, one displaying the Header for my site and the Title of the lesson. The other contains a PDF of the file. Does anyone have some code I could use to achieve my goals. I do not need the Frameset, but I HAVE to have only the LATEST lesson.

Thank you for any help

Micah :D
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

SELECT `DATE`, `TITLE` FROM `your_table` WHERE `DATE` <= (CURDATE() + 0) ORDER BY `DATE` DESC LIMIT 1
since you've decided to store the binary inside the database, you'll need to pass information to the second frame to load that out of the database. You can pass this information through a variety of means, but often the easiest, is through $_GET. I'd pass the id, if you have it, or the date, so you can use a script to find the correct file. We often suggest not storing binaries in the database because to display them requires an additional database query.
smartknight
Forum Newbie
Posts: 2
Joined: Sat Jan 08, 2005 12:21 pm

smartknight

Post by smartknight »

hi,


thanks for this information.


thanks & regards,

smartknight
Post Reply