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? Link to comment https://forums.phpfreaks.com/topic/96885-sql-field-addon/ 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? Link to comment https://forums.phpfreaks.com/topic/96885-sql-field-addon/#findComment-495786 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? Link to comment https://forums.phpfreaks.com/topic/96885-sql-field-addon/#findComment-495788 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. Link to comment https://forums.phpfreaks.com/topic/96885-sql-field-addon/#findComment-495792 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 Link to comment https://forums.phpfreaks.com/topic/96885-sql-field-addon/#findComment-495797 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"; Link to comment https://forums.phpfreaks.com/topic/96885-sql-field-addon/#findComment-495802 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! Link to comment https://forums.phpfreaks.com/topic/96885-sql-field-addon/#findComment-495843 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.