Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Auto deletion of data in my database

    i'm doing a webpage using php codings. i need help in the auto deletion of my data from my database.

    For example i have an announcement to announce today and end tomorrow and by tomorrow i want the announcement to be deleted from the database. how do i aoto delete the data from my database? And scripts to help me? i'm still using the old php and mysql. pls help. its urgent. Thanks!

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    welcome here.

    Dependes on what you call autodeletion. I suppose it's removing the records, from the table). mySQL sadly doesn't support stored procedures so you need to invoke a script that does the deleting. The delting itself is simple.

    $del="DELETE FROM table WHERE DATEDIFF(datevariable, Now()) >= 1"
    $result=mysql_query($del) or die('Querysproblem')

    (replace bold with your actual names. inside the table, you need a variablke with the date on which this record is supposed to be displayed)

    But you need to automatically run this script each day (at 00:00:00 hour) with a CRON-job or a Scheduled Task (depending on the platform you are on.

    Or you can just click a link each few days to remove these records if you want to have some level of control over it (i don't immedeately see the need to do this daily, since you can just select on the displaydate and leave all past messages inthere till the end of the month/year or so)

  • #3
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    full scripts

    hi sorry to bother again.
    i'm new to php therefore i need the full script. or just by writing the 2 lines you had given to me then i just insert it into the scheduled task and it will run? sorry to bother.

  • #4
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Connection?

    And do i need to put in any connection codes? sorry to bother again. thanks!

  • #5
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error

    i've run the application and has convert it into .exe file but when i run the command prompt prompt me the following error:

    The NTVDM CPU has encountered an illegal instructions.
    CS:0e10 IP:0217 OP:63 61 6c68 6 f

    What does this mean?

    Thanks for helping. sorry to bother again.


  •  

    Posting Permissions

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