Is there a way of collapsing columns in a MySQL table with php?

fastismatt

New member
I have a table where I'm working with data that is ordered by time of input. It's similar to something like a mail system, but instead of attaching a timestamp in another cell on the same row, I either update the last null value in a column or, if the last value in the row isn't null, I insert the message into a cell. These NULL values are produced when one column extends beyond another or a message is deleted.

So for example here is a shortened version of my table...

(notify) | (mail) | row(primary key)
news | hello! | 1
NULL | NULL | 2
stuff | NULL | 3

So if I add a mail message and then a notify message, my table will look like this...

(notify) | (mail) | row(primary key)
news | hello! | 1
NULL | NULL | 2
stuff | Blah b | 3
hi | NULL | 4


I want to then be able to rearrange my table to look like...

(notify) | (mail) | row(primary key)
news | hello! | 1
stuff | Blah b | 2
hi | NULL | 3
NULL | NULL | 4

Then since there are no values in the 4th row, I'd like to just delete it.


Is there a way I can do this with php after every function that updates this table?
 
Back
Top