dennismonsewicz Posted April 2, 2008 Share Posted April 2, 2008 I also have a field in my Database that is supposed to track who downloads what image, but how do I update the field so it just adds the username to the field without overwriting the previous entry? Quote Link to comment Share on other sites More sharing options...
unsider Posted April 2, 2008 Share Posted April 2, 2008 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. Quote Link to comment Share on other sites More sharing options...
trq Posted April 2, 2008 Share Posted April 2, 2008 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. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted April 2, 2008 Author Share Posted April 2, 2008 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 Quote Link to comment Share on other sites More sharing options...
unsider Posted April 2, 2008 Share Posted April 2, 2008 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.