Well Im making a site submit kinda script and I wanna give the option to allow my users to download the current list of sites submitted. Now I was thinking somthing like a Export mysql table to a text file but I dont know how or if its such a hot idea since what if theres 200 people all clicking at it the same time.

To solve that I was thinking maby have it auto save to the same folder the submit page is in so it will just auto export the sql table to the text file and alow people to download it. I still dont know how to Export to a format or how to set a given timer using php alone without a cron. Can anyone help me? Right now the Table name will be called "Name" and the database would be called "sitelist".

Much thanks to anyone that can help me with this.

    cross-post? Im just looking for a method of doing this since I have no clue how to start a mysql table exporter. :queasy:

      Hey,

      Well, if all you really need to offer is just a downloadable list, I would suggest this...

      Make a script to write the sites to a text file. Basically just open the text file (fopen()); execute a query like "select * from sites" and then loop through them all; for each one, write it to the text file with a '\n\r' at the end.

      Then just have a link to the text file for the visitors to click on and download.

      And as far as when to execute the script...
      If you are updating the database through some kind of admin, then you can add a script to the admin to rewrite the text file each time it updates the database. Or each time someone submits a site, rewrite the text file. That is what I suggest - basically each time the table itself is updated, update the text file as well.

      Hope that helped!
      Heather

      ps: Here's some info about writing to text files: http://us3.php.net/manual/en/function.fopen.php.

        raspberryh wrote:

        Hey,

        Well, if all you really need to offer is just a downloadable list, I would suggest this...

        Make a script to write the sites to a text file. Basically just open the text file (fopen()); execute a query like "select * from sites" and then loop through them all; for each one, write it to the text file with a '\n\r' at the end.

        Then just have a link to the text file for the visitors to click on and download.

        And as far as when to execute the script...
        If you are updating the database through some kind of admin, then you can add a script to the admin to rewrite the text file each time it updates the database. Or each time someone submits a site, rewrite the text file. That is what I suggest - basically each time the table itself is updated, update the text file as well.

        Hope that helped!
        Heather

        ps: Here's some info about writing to text files: http://us3.php.net/manual/en/function.fopen.php.

        Thanks! I was thinking of using txt but figured it load slow but after testing it with a few very big files it turned out good and fast. So thank you for your feedback.

        As of right now I re-coded most of the script to allow people to submit a url, it then looks through the txt file to see if it already exists and then echos back eathor success your url was added or sorry the url you submitted is already in out database. That seems to be the only thing that kinda takes some time but I guess its not that much of an issue.

        Anyway thanks for your help.

          Write a Reply...