Sql table reset after 24 hours... Help please

Discussion in 'MySQL' started by DjZoC, Jun 3, 2010.

  1. #1
    hello there, i will try to explain what im trying to do on my website, people can add links with there websites but i want to add limit 3 links / website per 24 hours, so if they add just 1 or 2 or 3 in 24 hours to UPDATE the table from 3 or 2 or 1 to 0

    im not sure if this is MySql or Php programming, hope someone made this before and can help me...

    dbtable : web_url

    table:
    |_weburl_______________|_number___________________|
    |http://www.test.com____|_2_________________________|

    so all what is from "number" to be reseted evry 24 hours

    if number: 0 == dont reset
    if number: 1/2/3 == reset after 24 hours to 0

    so when the person add 3 links, he need to wait after 24 hours to can add again links
     
    DjZoC, Jun 3, 2010 IP
  2. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #2
    Simple Just use your PHP Time Function and intialize another one which subtracts 24 hours from it
    And once its over use UPDATE or ALTER to do the job
     
    roopajyothi, Jun 4, 2010 IP
  3. ashu_sood08

    ashu_sood08 Peon

    Messages:
    125
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you have need to apply the validation tecnique on your table and write the procedure
    declaration
    web_url _var varchar2(10)
    begin
    I_ web_url=&web_url_var;
    if I_web_url>3;
    then
    dbms.output.putline("you have no permission to insert more url");
    else
    insert into weburl(url varchar(10));
     
    ashu_sood08, Jun 4, 2010 IP