Results 1 to 4 of 4

Thread: PHP : Increment date in mysql

  1. #1
    Join Date
    Mar 2008
    Posts
    349

    PHP : Increment date in mysql

    Hello!

    How can I update the value of a table field each time a page is viewed? I want to increment the value by one everytime the object is viewed. If there is a way of doing this can someone please point me in the right direction with regards to coding this? How do I setup my database/table to do that?

  2. #2
    Join Date
    May 2008
    Posts
    177

    Re: PHP : Increment date in mysql

    You can do the add strtotime by the no. of days you want ,

    e.g.

    Code:
     $today="2009-06-02";
     $nextday=strftime("%Y-%m-%d", strtotime("$today +1 day"));

  3. #3
    Join Date
    Dec 2007
    Posts
    195

    Re: PHP : Increment date in mysql

    That's the only possible way I know of. Correct me if I'm wrong - but MySQL doesn't have inbuilt time based triggers.
    Code:
    mysql> SELECT something FROM tbl_name
        -> WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= date_col;
    For more help : check this

  4. #4
    Join Date
    Mar 2008
    Posts
    335

    Re: PHP : Increment date in mysql

    You can try even this code :
    Code:
    'strConnection was initialized on the module
    Dim adConnection as ADODB.Connection
    Set adConnection = New ADODB.Connection
    adConnection.ConnectionString = strConnection
    adConnection.Open
    adConnection.Execute "INSERT INTO persons(lastname, firstname, middlename) VALUES ('lastname','firstname','middlename')"
    adConnection.Close

Similar Threads

  1. Replies: 6
    Last Post: 16-12-2009, 06:31 PM
  2. Replies: 3
    Last Post: 07-11-2009, 09:36 PM
  3. PHP Need to subtract day from MySQL date
    By strangist in forum Software Development
    Replies: 3
    Last Post: 31-07-2009, 06:51 PM
  4. MySQL date & time function.
    By Amaresh in forum Software Development
    Replies: 2
    Last Post: 19-06-2009, 02:49 PM
  5. [Excel] no increment date
    By Florian in forum Windows Software
    Replies: 3
    Last Post: 15-10-2008, 05:28 PM

Tags for this Thread

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
  •  
Page generated in 1,714,138,409.30316 seconds with 17 queries