czappa Posted February 26, 2009 Share Posted February 26, 2009 i have spent the last few days learning how to obtain a list and then link each result to another query. here is the code. mysql_select_db($database_online, $online); // if no meetid is specified, list the meets if(!isset($_GET['meetid'])) { $self = $_SERVER['PHP_SELF']; $query = "SELECT meetid, meetname, DATE_FORMAT(meetdate, '%m/%d/%Y') FROM meet ORDER BY meetdate DESC"; $result = mysql_query($query) or die('Error : ' . mysql_error()); // create the meet list $meethost = '<ol>'; while($row = mysql_fetch_array($result, MYSQL_NUM)) { list($meetid, $meetname, $meetdate) = $row; $meethost .= "<li><a href=\"$self?meetid=$meetid\">$meetname $meetdate</a></li>\r\n"; } $meethost .= '</ol>'; $meetname = 'Meet List'; } else { // get the aresults info from database $query = "SELECT gymnasts.firstname, gymnasts.lastname, meet.meethost, meet.meetname, meet.meetdate, meetresults.level, meetresults.vault, meetresults.vaulplace, meetresults.unevenbars, meetresults.unevenbarsplace, meetresults.beam, meetresults.beamplace, meetresults.floor, meetresults.floorplace, meetresults.aaplace, meetresults.vault+meetresults.unevenbars+meetresults.beam+meetresults.floor AS AATotal, meetresults.agegroup, meetresults.ID, meet.meetid FROM meet INNER JOIN (gymnasts INNER JOIN meetresults ON gymnasts.gymnastid = meetresults.gymnastid) ON meet.meetid = meetresults.meetid WHERE meet.meetid=".$_GET['meetid'] . " ORDER BY meetresults.`level`, AATotal DESC"; $result = mysql_query($query) or die('Error : ' . mysql_error()); $row = mysql_fetch_array($result, MYSQL_ASSOC); $totalRows = mysql_num_rows($result); $meetname = $row['meetname']; $meethost = $row['meethost']; $firstname = $row['firstname']; $meetdate = $row['meetdate']; $v="Vault"; $ub="Bars"; $bb="Beam"; $fx="Floor"; $aa="All Around"; $Place="PL"; $Name="name"; $level="Level"; $AG="Age Goup"; $space =" "; } ?> i display the results using this output. <h1 align="center"><?php echo $meetname; ?></h1> <?php echo $meethost; echo $space; echo $meetdate; ///echo $firstname; // when displaying meet list show a link // to see the results if(isset($_GET['meetid'])) { ?> <tr> <td colspan="2"><?php echo $name; ?>Name</td> <td> </td> <td><?php echo $level; ?></td> <td>Age Group</td> <td>Vault</td> <td>PL</td> <td>Bars</td> <td>PL</td> <td>Beam</td> <td>PL</td> <td>Floor</td> <td>PL</td> <td>AA</td> <td>PL</td> </tr> <?php do { ?> <tr> <td colspan="2"><?php echo $row['firstname']; ?></td> <td><?php echo $row['lastname']; ?></td> <td><?php echo $row['level']; ?></td> <td><?php echo $row['agegroup']; ?></td> <td><?php echo $row['vault']; ?></td> <td><?php echo $row['vaulplace']; ?></td> <td><?php echo $row['unevenbars']; ?></td> <td><?php echo $row['unevenbarsplace']; ?></td> <td><?php echo $row['beam']; ?></td> <td><?php echo $row['beamplace']; ?></td> <td><?php echo $row['floor']; ?></td> <td><?php echo $row['floorplace']; ?></td> <td><?php echo $row['AATotal']; ?></td> <td><?php echo $row['aaplace']; ?></td> </tr> <?php } while ($row = mysql_fetch_assoc($result)); ?> <p> </p> <h1 align="center"><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Select Meet</a></h1> <?php } ?> How would i then set gymnast in the results of the individual meets to a link so when i click on it i would get the results of just that gymnast? i own this website and i am doing this work for myself and not getting paid for it. You can see the actual page at www.enateam.com/usag/results.php Link to comment https://forums.phpfreaks.com/topic/147032-linking-results-to-new-results/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.