Member Avatar for diafol
diafol

I recently came across an example where binary data was stored in a column which related to the sum of all foreign key id integers. This was the scenario:

id [int]
from [int]
message_title [varchar,100]
message [text]
to [int]

I assumed the 'to' field was a foreign key on the user id in the users table. However, on closer inspection the 'to' field was a sum of all user ids (as a multiple recipient field).

I assume that the user table had to have a primary key with the id autoincrement set in binary.

(in pHp)
From what I can gather, there is a form with all users listed with a checkbox. The POST variable then sums the active values and stores this as an integer -> 'to' field.
The value in the 'to' field is then compared to all the users in the users table to retrieve the recipients for editing /displaying the message onscreen.

I personally would have used a link table, or even array/serialized data for recipients. Can anybody shed any light on this technique?