dennismonsewicz Posted March 19, 2008 Share Posted March 19, 2008 Is there a way in mysql to add an entry into a database table like this: instead of update $tbl_name SET... The result from the above statement will just override the statement in the table is there a way to add on to the existing entry? Quote Link to comment Share on other sites More sharing options...
carlg Posted March 19, 2008 Share Posted March 19, 2008 I'm not sure what you are talking about. Based upon this statement is there a way to add on to the existing entry? it makes me think you are asking how to concatenate? Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted March 19, 2008 Author Share Posted March 19, 2008 I suppose: Here is a better example I am trying to track down everyone who downloads a file and dump their username into a database. And I don't want the names to be updated so that they are erased. If you have user1 in your database and user2 downloads the file, is there a way to add user2 in the same row as user1? Quote Link to comment Share on other sites More sharing options...
carlg Posted March 19, 2008 Share Posted March 19, 2008 OK, let me try, I don't know the names of your fields so I'll make em up. insert into tablename (field1, field2, field3, username) values select field1, field2, field3, "2ndUser" from tablename where usnername = "1stuser" I don't have a database in front of me right now, but you may or may not need the values clause. Let me know if this helps, I may have the sytax messed up a bit, but the concept is there. Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted March 19, 2008 Author Share Posted March 19, 2008 i think what I will do is just create another table that will just insert the username (of the user downloading the file) and filename (the filename of the file being downloaded) and just parse the data as needed Quote Link to comment Share on other sites More sharing options...
carlg Posted March 19, 2008 Share Posted March 19, 2008 Let me try one last time (username field already has user1 as downloading this file) You could also choose a delimiter to place between the user names update tablename set username = concat(username, "user2") where filename = "Thedownloadfile.txt"; Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted March 19, 2008 Author Share Posted March 19, 2008 hmmmm... I will give it a shot. Thanks for your help bud! 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.