PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 9th, 2000, 05:40 PM
john k john k is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 2 john k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
HI all,

I want to setup a table in mysql where one of the fields is a text file. I want to be able to set up a form where the user makes a selection, a query is sent and the text file is returned. Is this possible?

Thanks,

John


Reply With Quote
  #2  
Old June 9th, 2000, 11:58 PM
baldwnad baldwnad is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 30 baldwnad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
Send a message via ICQ to baldwnad
You can do this 1 of 2 ways. Either setup an entry in your database that is just a pointer to a text file that will be read. Or you could acutally include the entire textfile in the database entry.

Something like this might work (it is late here and writing code on the fly might not be the best thing for me right now)

<?

if($action == "Submit") {

readfile("your.form.txt");
//I assume you setup the database connection
//already
$query = "SELECT * FROM textfiles where (name = $textfile)";

$result = $mysql_query($query);

readfile($result);
}
else {

//display your form if no default varibles are set

readfile("your.form.txt");
?>

I don't know if I was clear enough up there, so write with any questions. Basically if the user hits the page it will display the else clause, thus displaying your form that will when submitted cause the $action varible (the name of your submit button would be action, value would be Submit) and the $textfile variables to be set either in with a post or get method for your form. When the form is submited, it querys for the textfile you want and then uses that it gets as a pointer to readfile it...or display it. It might not be that clean, but it is one way to do it. I would have made it cleaner if I wasn't about to go to sleep...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Return a text file upon query

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap