CREATETABLE t_cust_acct (
o_id INT NOT NULL AUTO_INCREMENT,
o_user VARCHAR(12) NOT NULL,
o_pass VARCHAR(12) NOT NULL,
o_mail VARCHAR(255) NOT NULL,
c_0 INT(2) NOT NULL,
c_1 INT(1) NOT NULL,
c_2 INT(1) NOT NULL,
c_3 INT(1) NOT NULL,
c_4 INT(1) NOT NULL,
PRIMARY KEY ( o_id ),
UNIQUE (
o_user
),
CONSTRAINT c_validate CHECK (
c_0 = ( c_1 + c_2 + c_3 + c_4 )
))
So for example all field names starting with c_ are meant to be covert and have no representative fields on a HTML form; The form feedback page will generate four random numbers between -9 and 9 on the PHP server and then set the fields c_1 c_2 c_3 and c_4; c_0 will be the sum of these four numbers so that the insert doesn't fail due to the c_validate constraint.
Will this work as intended?