Fenhopi Posted June 26, 2010 Share Posted June 26, 2010 Hi, I'm making a system similar to the like system in facebook. THis is what I got: $insertlike = "UPDATE status SET likes='$username' WHERE statusid='$statusid'"; And that works fine. But when another user likes the same post he replaces the previous user who like the post. Is there anyway I can add his username to the already added username? Thanks for your time and help! Link to comment https://forums.phpfreaks.com/topic/205906-adding-a-value-to-an-existing-value-in-mysql-column/ Share on other sites More sharing options...
bluejay002 Posted June 26, 2010 Share Posted June 26, 2010 I am not sure if this will work as I haven't tested this but you may want to give this a try: $connector = ";"; // choose what would be convenient for you $insertlike = "UPDATE status SET likes=CONCAT(likes, '$connector','$username') WHERE statusid='$statusid'"; Just give it a try and reply back if it is still not working. bluejay, Link to comment https://forums.phpfreaks.com/topic/205906-adding-a-value-to-an-existing-value-in-mysql-column/#findComment-1077473 Share on other sites More sharing options...
Fenhopi Posted June 26, 2010 Author Share Posted June 26, 2010 Just figured it out before I saw your post. Thanks for replying though! Appreciated! Link to comment https://forums.phpfreaks.com/topic/205906-adding-a-value-to-an-existing-value-in-mysql-column/#findComment-1077474 Share on other sites More sharing options...
bluejay002 Posted June 26, 2010 Share Posted June 26, 2010 np. Link to comment https://forums.phpfreaks.com/topic/205906-adding-a-value-to-an-existing-value-in-mysql-column/#findComment-1077475 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.