Combining Multiple Rows Into One For Result
I've got what is in it's most simplistic form - a "form builder" application which allows someone to build a completely custom form. After choosing their fields and building the form each form field and it's associated parameters are stored as a row in a database.
When a form respondent fills out this form I'm storing each input value into a separate row (which I don't have to do but would like to). I'm trying to figure out how I can pull out the form results but combine each into one row (ie. to print out all fields into a table).
`submission` is the unique string that ties all rows together. There's a unique string for every form submission. I'd like to be able to print out a row that uses `input_id` as the column name and `value` as the value. I'd still need acess to `submitted`, `ip`, and `contest_id` from at least one of the rows.
CREATE TABLE `contest_entries` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`contest_id` int(11) DEFAULT NULL,
`input_id` int(11) DEFAULT NULL,
`value` varchar(255) DEFAULT NULL,
`ip` varchar(255) DEFAULT NULL,
`submitted` datetime DEFAULT NULL,
`submission` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=85 DEFAULT CHARSET=latin1;