Append to table column new data and keep old below that one

I want to add some activity logs to custom table i created in mysql. But i don’t want to put everything together or in separate rows every time i record some activity, rather i want to separate them by users.

So for example if i log user activity for user michael i would create separate row in table and that row will hold columns user to record user id and table logs to record user logs.

So if user michael try to make payment and fail i want to log his response in logs table and response would be array, but if michael try to make another payment and payment is success i want to add that record on top of previous record.

So when he fail log would write

Log date:<date and time>
array(
“paymentid”: “210931”,
“type”: “cc”,
“action”: “failed”
)

And after if he make another try just add data on top of that.

Log date:<date and time>
array(
“paymentid”: “301239”,
“type”: “cc”,
“action”: “success”
)
Log date:<date and time>
array(
“paymentid”: “210931”,
“type”: “cc”,
“action”: “failed”
)

Read more here:: Append to table column new data and keep old below that one

Leave a Reply

Your email address will not be published. Required fields are marked *