Thanks for the reply.
The main table I'm pulling the info from is tbl results code....
CREATE TABLE `tblresults` (
`resultid` INT(15) NOT NULL AUTO_INCREMENT,
`race_id` INT(10) NOT NULL DEFAULT '0',
`boatcrewid` INT(10) NOT NULL DEFAULT '0',
`hours` INT(10) NOT NULL DEFAULT '0',
`mins` INT(10) NOT NULL DEFAULT '0',
`secs` INT(10) NOT NULL DEFAULT '0',
`laps` INT(11) NOT NULL DEFAULT '0',
`reason` VARCHAR(50) NULL DEFAULT '0',
`corrected` FLOAT NOT NULL,
`seriesid` INT(10) NULL DEFAULT NULL,
`points` INT(10) NULL DEFAULT NULL,
PRIMARY KEY (`resultid`),
INDEX `racekey` (`race_id`),
INDEX `crewkey` (`boatcrewid`)
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
ROW_FORMAT=DEFAULT
AUTO_INCREMENT=4403
here's the query i'm trying to build the display table from on the page - the info is dragged in from a number of tables. My issue is trying to get the columns to expand to the right number of races (i.e. the occurrences of raceid per series id in the table above). Please note, the query below doesn't quite match the display code from earlier as I've been fiddling with it all day and have re-written it a few times!!.
$serieswanted_seriesresults1 = "-1";
if (isset($_POST['serieschoose'])) {
$serieswanted_seriesresults1 = $_POST['serieschoose'];
}
mysql_select_db($database_sailingdb, $sailingdb);
$query_seriesresults1 = sprintf("SELECT tblresults.race_id AS rid, tblresults.boatcrewid AS bcid, tblresults.reason AS rsn, tblresults.corrected AS crtd, tblresults.seriesid AS sid, tblresults.points AS points, tblseries.series AS series, tblraces.race_number AS rnumb, tblcompetitors.racecrewid AS rcid, tblcompetitors.helm AS hlm, tblcompetitors.crew AS crw, tblcompetitors.boat_id AS btid, tblcompetitors.sailnumber AS snumb, tblm1.name AS helm, tblm2.name AS crew, tblboats.boat_type AS boat FROM tblresults LEFT JOIN tblseries ON tblresults.seriesid = tblseries.seriesid LEFT JOIN tblraces ON tblresults.race_id = tblraces.raceid LEFT JOIN tblcompetitors ON tblcompetitors.racecrewid = tblresults.boatcrewid LEFT JOIN tblmember AS tblm1 ON tblm1.memberid = tblcompetitors.helm LEFT JOIN tblmember AS tblm2 ON tblm2.memberid = tblcompetitors.crew LEFT JOIN tblboats ON tblcompetitors.boat_id = tblboats.boatid WHERE tblresults.seriesid = %s", GetSQLValueString($serieswanted_seriesresults1, "int"));
$seriesresults1 = mysql_query($query_seriesresults1, $sailingdb) or die(mysql_error());
$row_seriesresults1 = mysql_fetch_assoc($seriesresults1);
$totalRows_seriesresults1 = mysql_num_rows($seriesresults1);