Reputation: 383
I'm building a website that has a user messaging system. I'm using MySQL to store every data. The inbox table is set up like this:
`mid` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`to_uid` INT UNSIGNED NOT NULL ,
`from_uid` INT UNSIGNED NOT NULL ,
`content` TEXT(4000) NOT NULL ,
`date` DATETIME NOT NULL ,
`isvisible` TINYINT(1) UNSIGNED NOT NULL DEFAULT 1 ,
I had the user-to-user messaging set up to use only characters and numbers so that's fine. What I'm trying to do are notification messages to the user. What's a good way to insert messages if they contain php variables and html? Here's where I am so far before inserting it.
$content = "".$username." is requesting to join your trip. Click <a href=\"browse.php?tid=D".$t_tid."\">here</a> to go to the trip.<button>here\'s a button</button>";
Is this the proper way? I'm just a beginner so anyone who could shed some light is greatly appreciated.
Upvotes: 0
Views: 110
Reputation: 57650
I think you can add a column like this
`message_type` enum ('REQ_JOIN_GROUP', 'REQ_FRINDSHIP', 'REQ_TAG_APPROVE', 'MSG_PRIV', 'MSG_WALL', 'TAG_PHOTO', 'TAG_NOTE')
`message_param` varchar(20)
Depending on the message type you can just create the message.
For example.
Just normalize it.
Upvotes: 1