Jump to content

[SOLVED] Updating downloaded by field


dennismonsewicz

Recommended Posts

Eh, you question is confusing me, so this may not be the answer you want..

 

I'm assuming you are trying to input the info into a DB?

If you have set up a DB table 'downloads' for example. Just have it input the username and no other info. If it's a DB it won't overwrite anything.

 

 

Link to comment
Share on other sites

You'll want a seperate table.

 

CREATE TABLE trackdownloads (
 id INT AUTO INCREMENT,
 download_id INT,
 user_id INT
);

 

Where download_id and user_id represent the ids of the download and users respectfully.

Link to comment
Share on other sites

Ok,

 

Let me try to explain this a little better.

 

I am wanting to track which image a user downloads. I have a downloaded_by field in my DB. Is there anyway to update this field with the username and have it just add the username on everytime that image is downloaded?

 

For example:

 

downloaded_by: dennis, john, susie...

 

Instead of overwriting this field everytime

Link to comment
Share on other sites

when the user clicks to DL the image, route their session username to the 'downloaded_by' table, and have a timestamp or id value so you can properly organize which values should be output, and use the timestamp to output

 

ORDER by DESC, LIMIT 0, 1

 

look up a little about SQL, ordering, DESC, LIMIT, etc..

 

From what your asking, that is the most effective method, and it only requires 2 DB tables, and it will never fail you.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.