Jump to content

SQL field addon


dennismonsewicz

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.