Monkuar Posted March 14, 2012 Share Posted March 14, 2012 $db->query('UPDATE users set actions=actions+1|'.time().' where id = '.$pun_user['id'].''); im trying to do set actions=actions+1, then put a | atfter +1ing it, then add my time stamp to it so I can explode it later. so it will look like this 2|unixtimestamphere how would i achieve this? or do I need to make another seperate row? seems dumb Quote Link to comment https://forums.phpfreaks.com/topic/258898-how-to-increment-value-and-add-a-another-value/ Share on other sites More sharing options...
trq Posted March 14, 2012 Share Posted March 14, 2012 Each column is designed to hold one value in a database. You need a new column. Quote Link to comment https://forums.phpfreaks.com/topic/258898-how-to-increment-value-and-add-a-another-value/#findComment-1327242 Share on other sites More sharing options...
Muddy_Funster Posted March 14, 2012 Share Posted March 14, 2012 as thorp said, each piece of information should be stored in it's own field, but if you want to do it the other way you could use something like the following - just dont come asking how to perform lookups on your data or how to get it back out in a meaningfull form $db->query('UPDATE users set actions=CONCAT((SELECT actions+1),"|","'.time().'") where id = '.$pun_user['id'].''); Quote Link to comment https://forums.phpfreaks.com/topic/258898-how-to-increment-value-and-add-a-another-value/#findComment-1327246 Share on other sites More sharing options...
Monkuar Posted March 14, 2012 Author Share Posted March 14, 2012 Each column is designed to hold one value in a database. You need a new column. Hey, I'll use Muddy_funster's way, just because Im not going to be selecting any data from this field, just displaying it, so holding the data is fine for what I am doing, but I understand you and where you're coming from, it's prob bad to store values in explode if they're going to have to be selected later, but as of right now it's just a info it's fine and will never have to be selected again I'll use muddy_funster's way for this, didn't know concat did that, will look into concat's function @ mysql and learn some more goodies, Thanks Muddy Topic Solved Quote Link to comment https://forums.phpfreaks.com/topic/258898-how-to-increment-value-and-add-a-another-value/#findComment-1327264 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.