Jump to content

setting a result as criteria for new sql statment


czappa

Recommended Posts

OK so i am new to PHP and i have some simple things done and I need help with a problem.

 

I have a competition team and i want to display the results.  I have 3 tables set up with relationships tables are Gymnast, Meet, Results

my joins are meetID, GymnastID, resultsID.

 

i am currently pulling the information using Meetid as a criteria for the sql statement.

 

 

 

the page to view the example is

 

http://enateam.com/usag/results.php

 

i am currently having the results set to a recordset id

then inserting the results into a table.

 

mysql_select_db($database_online, $online);

$query_pumpcup = "SELECT gymnasts.firstname, gymnasts.lastname, 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=7 ORDER BY meetresults.`level`, AATotal DESC";

$pumpcup = mysql_query($query_pumpcup, $online) or die(mysql_error());

$row_pumpcup = mysql_fetch_assoc($pumpcup);

$totalRows_pumpcup = mysql_num_rows($pumpcup);

 

<?php do { ?>

 

      <tr>

        <td colspan="2"><?php echo $row_pumpcup['firstname']; ?></td>

        <td><?php echo $row_pumpcup['lastname']; ?></td>

        <td><?php echo $row_pumpcup['level']; ?></td>

        <td><?php echo $row_pumpcup['agegroup']; ?></td>

        <td><?php echo $row_pumpcup['vault']; ?></td>

        <td><?php echo $row_pumpcup['vaulplace']; ?></td>

        <td><?php echo $row_pumpcup['unevenbars']; ?></td>

        <td><?php echo $row_pumpcup['unevenbarsplace']; ?></td>

        <td><?php echo $row_pumpcup['beam']; ?></td>

        <td><?php echo $row_pumpcup['beamplace']; ?></td>

        <td><?php echo $row_pumpcup['floor']; ?></td>

        <td><?php echo $row_pumpcup['floorplace']; ?></td>

        <td><?php echo $row_pumpcup['AATotal']; ?></td>

        <td><?php echo $row_pumpcup['aaplace']; ?></td>

      </tr>

      <?php } while ($row_pumpcup = mysql_fetch_assoc($pumpcup)); ?>

 

My question is this, i am setting up multiple query strings and then multiple tables to display the differnet meetresults.

I want to have the page load and see a list of meet names and then when a user clicks on the name the results for that competition will come up. 

 

Yes i am a newbie and any help would be appreciated.

 

2 options I can think of:

 

1) Don't call everything at once, make a link for each name that goes to something like getotherdetails.php?name=<echo the name here> and the have that page get the name value with $_GET and run a seperate SQL query to go retrive the information and echo it out.

 

2) Call everything and use some javascript to hide the extra info by default and then when the name is clicked the info shows up.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.