1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Rep Power
    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?



  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Rep Power
    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") {

    //I assume you setup the database connection
    $query = "SELECT * FROM textfiles where (name = $textfile)";

    $result = $mysql_query($query);

    else {

    //display your form if no default varibles are set


    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...

Similar Threads

  1. help with tables and wordwrapping
    By junkedBrian613 in forum PHP Development
    Replies: 2
    Last Post: February 15th, 2004, 05:42 PM
  2. Possible to read in value from a text file?
    By discus18 in forum PHP Development
    Replies: 2
    Last Post: February 6th, 2004, 11:19 PM
  3. help with an isGreater function
    By qiushiming in forum C Programming
    Replies: 18
    Last Post: February 5th, 2004, 08:23 AM
  4. Simple find and replace word search for a text file with php?
    By rabid lemming in forum PHP Development
    Replies: 4
    Last Post: February 1st, 2004, 09:37 PM
  5. How to read multiple line text file into a variable
    By gatewaycityca in forum Visual Basic Programming
    Replies: 4
    Last Post: January 29th, 2004, 12:26 PM

IMN logo majestic logo threadwatch logo seochat tools logo