Results 1 to 3 of 3

Thread: Javascript Timer and Mysql?

  1. #1
    Join Date
    Aug 2009
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Javascript Timer and Mysql?

    Is it possible to make a Javascript timer that deletes a row from a mysql database once it hits 0 and then starts the count back over to delete another row?


    I've made a PM system with php and would like it to delete old messages every 30 days that way my members can have it set to delete messages automatically or do it them selves.
    Last edited by Jeffreyv1987; 10-16-2010 at 11:23 PM.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Theoretically, it's possible. It's not possible using Javascript alone, but if you used "Ajax" you would be able to make a Javascript function that would, without reloading the page, run a PHP script on the server to do that.

    However, why??

    The much easier way to do this is to just add a mysql delete query every time you load the page-- delete messages more than 30 days old. That would do the same thing and be much easier. Since this is a long time, that's fine. Perhaps if you wanted to delete messages more than 30 seconds old you'd want to use Javascript, but I don't even see how the Javascript would be relevant-- would they remain on the page for more than 30 days?
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. The Following User Says Thank You to djr33 For This Useful Post:

    Jeffreyv1987 (10-16-2010)

  4. #3
    Join Date
    Aug 2009
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    To be honest I wasn't thinking about adding a mysql delete to the page load..
    i had been thinking about doing the timer thing for some time now..

    Thanks for helping me with that problem..

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •