Results 1 to 4 of 4

Thread: [RESOLVED] Add 1 To Download

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2008
    Posts
    84

    Resolved [RESOLVED] Add 1 To Download

    i am making an applocation that allows users to download files from the app. the list of available downoads is generated from a mysql database. I don't really know much sql so i am asking for your help.

    the table is setup like:

    Table Name: programs

    programid location programname programtype uploaded uploader

    i dont know if i should make the download column an auto increment integer or what, and how would i add 1 to the current # in the row.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Add 1 To Download

    To store the amount of downloads you should use an Integer of some sort (exactly which depends on how many downloads you expect), but not auto increment - as that is designed for fields like programid (so that each record can be uniquely identified).

    To increase it you would just use an Update statement with a Where clause that uniquely specifies the row, eg:
    Code:
    UPDATE programs
    SET download = download + 1
    WHERE programid = 27

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2008
    Posts
    84

    Re: Add 1 To Download

    thank you this worked

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Add 1 To Download

    As you now have it sorted out, could you please do us a little favour, and mark the thread as Resolved?
    (this saves time reading for those of us who like to answer questions, and also helps those who search to find answers)

    You can do it by clicking on "Thread tools" just above the first post in this thread, then "Mark thread resolved". (like various other features of this site, you need JavaScript enabled in your browser for this to work).

Posting Permissions

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



Click Here to Expand Forum to Full Width