Jump to content

aebstract

Members
  • Posts

    1,105
  • Joined

  • Last visited

Posts posted by aebstract

  1. $query2 = mysql_query("
    SELECT registrations.firstname, participants.eventid, registrations.lastname, participants.q1, participants.q2, participants.q3, participants.q1s, participants.q2s, participants.q3s, participants.q1rt, participants.q2rt, participants.q3rt, participants.regid
    FROM participants
    INNER JOIN registrations ON registrations.id = participants.regid
    WHERE participants.eventid = $_GET[event] AND registrations.class = '$var'") or DIE(mysql_error());
    if(mysql_num_rows($query)!=0){
    
    $indexL[$var] = array();
    $indexH[$var] = array();
    
    	while($r2=mysql_fetch_array($query2))
    	{
    
    	$var2 = substr($var,0,4);
    	if ((($r2[q1] + $r2[q1rt]) < $var2) && (($r2[q2] + $r2[q2rt]) < $var2) && (($r2[q3] + $r2[q3rt]) < $var2)){
    
    $indexL[$var][] = array('firstname' => "$r2[firstname]", 'lastname' => "$r2[lastname]", 'q1' => "$r2[q1]", 'q2' => "$r2[q2]", 'q3' => "$r2[q3]", 'regid' => "$r2[regid]", 'eventid' => "$r2[eventid]");
    
    } else {
    
    $indexH[$var][] = array('firstname' => "$r2[firstname]", 'lastname' => "$r2[lastname]", 'q1' => "$r2[q1]", 'q2' => "$r2[q2]", 'q3' => "$r2[q3]", 'regid' => "$r2[regid]", 'eventid' => "$r2[eventid]");
    
    }
    
    
    }
    }
    
    
    $countH = count($indexH[$var]);
    $countL = count($indexL[$var]);
    
    
    foreach ( $indexL[$var] as $val ){
        foreach ( $val as $final_val ){
          $content .= sprintf("%s <br/>", $final_val['firstname']);
       }
    }
    
    

  2. What are the bullet points?

     

    Also, why did you use a foreach loop if you're just going to display firstname all the time?

     

    I guess they got changed to bullets, it's indexes [0] [1] etc, none of them go over 1.

    Here is the full array for $indexL:

     

    Array

    (

        [4.70 Index] => Array

            (

                [ 0 ] => Array

                    (

                        [firstname] => Mike

                        [lastname] => Herring

                        [q1] => 4.616

                        [q2] => 4.669

                        [q3] => 4.686

                        [regid] => 118

                        [eventid] => 1

                    )

     

            )

     

        [5.30 Index] => Array

            (

                [ 0 ] => Array

                    (

                        [firstname] => Adam

                        [lastname] => Garner

                        [q1] => 5.286

                        [q2] => 5.286

                        [q3] => 5.286

                        [regid] => 109

                        [eventid] => 1

                    )

     

                [ 1 ] => Array

                    (

                        [firstname] => Ronnie

                        [lastname] => Clayton

                        [q1] => 5.219

                        [q2] => 5.228

                        [q3] => 5.228

                        [regid] => 155

                        [eventid] => 1

                    )

     

            )

     

        [6.00 Index] => Array

            (

            )

     

        [7.00 Index] => Array

            (

                [ 0 ] => Array

                    (

                        [firstname] => Terry

                        [lastname] => McClendon

                        [q1] => 6.998

                        [q2] => 6.998

                        [q3] => 6.998

                        [regid] => 83

                        [eventid] => 1

                    )

     

            )

     

    )

     

    I put spaces so it wouldn't change. I plan on doing other things with the values in the array, I was just trying to get a grasp on how to control the values and so far I can't get the value.

     

     

     

     

    teamatomic:

    When I try that code, I get this output:

     

    4.70

    M

    H

    4

    4

    4

    1

    1

     

    5.30 Index

    A

    G

    5

    5

    5

    1

    1

    R

    C

    5

    5

    5

    1

    1

     

    6.00 Index

     

     

    7.00 Index

    T

    M

    6

    6

    6

    8

    1

  3. foreach ( $indexL[$var] as $val ){
        foreach ( $val as $key=>$final_val ){
    	$content .= "$key[firstname]";
    }
        $content .= "<br>";
    }
    

     

    Here are the results from a print_r($indexL[$var]);

     

    Array

    (

        [0] => Array

            (

                [firstname] => Mike

                [lastname] => Herring

                [q1] => 4.616

                [q2] => 4.669

                [q3] => 4.686

                [regid] => 118

                [eventid] => 1

            )

     

    )

     

    Array

    (

        [0] => Array

            (

                [firstname] => Adam

                [lastname] => Garner

                [q1] => 5.286

                [q2] => 5.286

                [q3] => 5.286

                [regid] => 109

                [eventid] => 1

            )

     

        [1] => Array

            (

                [firstname] => Ronnie

                [lastname] => Clayton

                [q1] => 5.219

                [q2] => 5.228

                [q3] => 5.228

                [regid] => 155

                [eventid] => 1

            )

     

    )

     

    Array

    (

    )

     

    Array

    (

        [0] => Array

            (

                [firstname] => Terry

                [lastname] => McClendon

                [q1] => 6.998

                [q2] => 6.998

                [q3] => 6.998

                [regid] => 83

                [eventid] => 1

            )

     

    )

     

    My output looks like:

     

    flqqqre

     

    flqqqre

    flqqqre

     

    flqqqre

     

     

    I tried to use $final_val[firstname] but it gave me odd results too.

  4. Okay I have 2 databases, almost similar. One is more up to date with newer information, a lot of the information is the same though. I accidentally wrote over an entire column in one of my tables. I need to update it with my old database info from that column. The other columns need to be left alone though.

    I did a simple select q1, id from table to get all the results and exported it out but it gave it to me in the form of an insert, obviously. (coming out of phpmyadmin)

     

    INSERT INTO `participants` (`q1`, `id`) VALUES (6.216, 1),

    (6.048, 2),

    (99.999, 3),

    (6.866, 4),

    (6.105, 6),

    (4.730, 7),

    (4.685, 8),

    (5.044, 9),

    (4.822, 10),

    (4.730, 11),

    (6.066, 115),

    (4.977, 12),

    (5.041, 13),

    (4.760, 14),

    (5.297, 15),

    (5.377, 16),

    (5.276, 17),

    (5.295, 18),

    (7.966, 19),

    (5.286, 20),

    (99.999, 21),

    (99.999, 22),

    (5.340, 23),

    (5.368, 24),

    (5.075, 25),

    (7.040, 26),

    (6.998, 27),

    (7.013, 28),

    (7.054, 29),

    (7.508, 30),

    (7.026, 31),

    (7.002, 32),

    (99.999, 33),

    (6.986, 34),

    (7.006, 35),

    (99.999, 36),

    (7.077, 37),

    (7.063, 38),

    (6.939, 39),

    (7.135, 40),

    (6.682, 41),

    (6.990, 42),

    (7.116, 43),

    (7.125, 44),

    (5.988, 45),

    (6.073, 47),

    (5.985, 48),

    (6.086, 49),

    (99.999, 50),

    (8.657, 51),

    (7.001, 52),

    (6.989, 53),

    (7.009, 54),

    (6.983, 55),

    (7.007, 56),

    (6.966, 57),

    (5.412, 58),

    (4.906, 59),

    (4.718, 60),

    (4.980, 61),

    (5.983, 62),

    (6.021, 63),

    (99.999, 64),

    (4.489, 65),

    (5.283, 66),

    (4.388, 67),

    (5.024, 68),

    (6.538, 69),

    (6.581, 71),

    (99.999, 73),

    (99.999, 74),

    (6.710, 75),

    (4.985, 76),

    (5.803, 77),

    (5.908, 78),

    (6.075, 79),

    (4.794, 80),

    (99.999, 81),

    (5.390, 82),

    (6.002, 83),

    (5.994, 84),

    (6.304, 85),

    (99.999, 86),

    (6.157, 87),

    (6.144, 88),

    (99.999, 132),

    (7.142, 131),

    (7.033, 130),

    (7.081, 92),

    (6.977, 93),

    (4.616, 94),

    (7.419, 95),

    (5.323, 96),

    (5.412, 97),

    (4.380, 98),

    (4.427, 99),

    (4.726, 100),

    (4.719, 101),

    (5.292, 102),

    (5.585, 103),

    (5.617, 104),

    (5.345, 105),

    (6.240, 106),

    (5.695, 107),

    (6.006, 108),

    (4.832, 109),

    (6.934, 110),

    (7.580, 111),

    (7.019, 112),

    (7.481, 113),

    (7.008, 114),

    (4.576, 116),

    (5.824, 117),

    (6.085, 118),

    (5.546, 119),

    (99.999, 120),

    (5.940, 121),

    (7.369, 122),

    (9.051, 123),

    (7.203, 124),

    (5.720, 125),

    (5.835, 127),

    (4.466, 128),

    (4.766, 129),

    (5.286, 133),

    (5.219, 134),

    (21.705, 135),

    (5.026, 136),

    (0.000, 137),

    (0.000, 138),

    (0.000, 139),

    (0.000, 140),

    (0.000, 141),

    (0.000, 142),

    (0.000, 143),

    (0.000, 144),

    (0.000, 145),

    (0.000, 146),

    (0.000, 147),

    (0.000, 148),

    (0.000, 149),

    (0.000, 150),

    (0.000, 151),

    (0.000, 152),

    (0.000, 153),

    (0.000, 154),

    (0.000, 155),

    (0.000, 156),

    (0.000, 157);

     

    Anything simple to fix my problem?

  5. I've got something I've been working on and have tried 2 different methods. One using a different database setup and another using these arrays, which I can't get them to set correctly. I'm sitting here just wasting time because I can't figure it out and no one has an answer. Though, I'm basically stuck here until I do figure it out.

     

    I don't get why this:

    $query2 = mysql_query("
    SELECT registrations.firstname, participants.eventid, registrations.lastname, participants.q1, participants.q2, participants.q3, participants.q1s, participants.q2s, participants.q3s, participants.q1rt, participants.q2rt, participants.q3rt, participants.regid
    FROM participants
    INNER JOIN registrations ON registrations.id = participants.regid
    WHERE participants.eventid = $_GET[event] AND registrations.class = '$var'") or DIE(mysql_error());
    if(mysql_num_rows($query)!=0){
    
    $indexL[$var] = array();
    
    	while($r2=mysql_fetch_array($query2))
    	{
    $indexL[$var] = array("$r2[firstname]", "$r2[lastname]", "$var");
    }
    }
    

     

    Is only setting this:

    Array

    (

        [4.70 Index] => Array

            (

                [0] => Jeff

                [1] => Wilkerson

                [2] => 4.70 Index

            )

     

        [5.30 Index] => Array

            (

                [0] => Ronnie

                [1] => Clayton

                [2] => 5.30 Index

            )

     

        [6.00 Index] => Array

            (

                [0] => Ricki

                [1] => Blackwell

                [2] => 6.00 Index

            )

     

        [7.00 Index] => Array

            (

                [0] => Adam

                [1] => Stratton

                [2] => 7.00 Index

            )

     

    )

     

     

     

    Even though this isn't what I'm going for, it's still a very basic array just to see what is up. I'm only returning one result per class, but my query doesn't have that limit on it?

  6. Erm, getting back some odd results:

     

    
    $query2 = mysql_query("
    SELECT registrations.firstname, participants.eventid, registrations.lastname, participants.q1, participants.q2, participants.q3, participants.q1s, participants.q2s, participants.q3s, participants.q1rt, participants.q2rt, participants.q3rt, participants.regid
    FROM participants
    INNER JOIN registrations ON registrations.id = participants.regid
    WHERE participants.eventid = $_GET[event] AND registrations.class = '$var'") or DIE(mysql_error());
    if(mysql_num_rows($query)!=0){
    
    
    	while($r2=mysql_fetch_array($query2))
    	{
    
    $var2 = substr($var, 0, 4);
    
    if (($r2[q1] < $var2) && ($r2[q2] < $var2) && ($r2[q3] < $var2)) {
    $indexqpL[$var] = array(array(regid => "$r2[regid]",
                          firstname => "$r2[firstname]",
                          lastname => "$r2[lastname]",
                          eventid => "$r2[eventid]",
                          q1 => "$r2[q1]",
                          q2 => "$r2[q2]",
                          q3 => "$r2[q3]",
                        ));
                 											} else {
    $indexqpH[$var] = array(array(regid => "$r2[regid]",
                          firstname => "$r2[firstname]",
                          lastname => "$r2[lastname]",
                          eventid => "$r2[eventid]",
                          q1 => "$r2[q1]",
                          q2 => "$r2[q2]",
                          q3 => "$r2[q3]",
                        ));
                 												}
    
    
    	}
    
    }
    echo "<pre>";
    var_dump($indexqpH);
    echo "</pre>";
    
    

     

     

    array(1) {

      ["4.70 Index"]=>

      array(1) {

        [0]=>

        array(7) {

          ["regid"]=>

          string(3) "217"

          ["firstname"]=>

          string(4) "Jeff"

          ["lastname"]=>

          string(9) "Wilkerson"

          ["eventid"]=>

          string(1) "1"

          ["q1"]=>

          string(5) "5.026"

          ["q2"]=>

          string(5) "4.902"

          ["q3"]=>

          string(5) "4.902"

        }

      }

    }

     

    array(2) {

      ["4.70 Index"]=>

      array(1) {

        [0]=>

        array(7) {

          ["regid"]=>

          string(3) "217"

          ["firstname"]=>

          string(4) "Jeff"

          ["lastname"]=>

          string(9) "Wilkerson"

          ["eventid"]=>

          string(1) "1"

          ["q1"]=>

          string(5) "5.026"

          ["q2"]=>

          string(5) "4.902"

          ["q3"]=>

          string(5) "4.902"

        }

      }

      ["5.30 Index"]=>

      array(1) {

        [0]=>

        array(7) {

          ["regid"]=>

          string(3) "207"

          ["firstname"]=>

          string(5) "Shawn"

          ["lastname"]=>

          string(8) "Mcdonald"

          ["eventid"]=>

          string(1) "1"

          ["q1"]=>

          string(5) "5.546"

          ["q2"]=>

          string(5) "5.546"

          ["q3"]=>

          string(5) "5.546"

        }

      }

    }

     

    array(3) {

      ["4.70 Index"]=>

      array(1) {

        [0]=>

        array(7) {

          ["regid"]=>

          string(3) "217"

          ["firstname"]=>

          string(4) "Jeff"

          ["lastname"]=>

          string(9) "Wilkerson"

          ["eventid"]=>

          string(1) "1"

          ["q1"]=>

          string(5) "5.026"

          ["q2"]=>

          string(5) "4.902"

          ["q3"]=>

          string(5) "4.902"

        }

      }

      ["5.30 Index"]=>

      array(1) {

        [0]=>

        array(7) {

          ["regid"]=>

          string(3) "207"

          ["firstname"]=>

          string(5) "Shawn"

          ["lastname"]=>

          string(8) "Mcdonald"

          ["eventid"]=>

          string(1) "1"

          ["q1"]=>

          string(5) "5.546"

          ["q2"]=>

          string(5) "5.546"

          ["q3"]=>

          string(5) "5.546"

        }

      }

      ["6.00 Index"]=>

      array(1) {

        [0]=>

        array(7) {

          ["regid"]=>

          string(3) "206"

          ["firstname"]=>

          string(6) "Ricki "

          ["lastname"]=>

          string(9) "Blackwell"

          ["eventid"]=>

          string(1) "1"

          ["q1"]=>

          string(5) "6.085"

          ["q2"]=>

          string(5) "6.085"

          ["q3"]=>

          string(5) "6.045"

        }

      }

    }

     

    array(4) {

      ["4.70 Index"]=>

      array(1) {

        [0]=>

        array(7) {

          ["regid"]=>

          string(3) "217"

          ["firstname"]=>

          string(4) "Jeff"

          ["lastname"]=>

          string(9) "Wilkerson"

          ["eventid"]=>

          string(1) "1"

          ["q1"]=>

          string(5) "5.026"

          ["q2"]=>

          string(5) "4.902"

          ["q3"]=>

          string(5) "4.902"

        }

      }

      ["5.30 Index"]=>

      array(1) {

        [0]=>

        array(7) {

          ["regid"]=>

          string(3) "207"

          ["firstname"]=>

          string(5) "Shawn"

          ["lastname"]=>

          string(8) "Mcdonald"

          ["eventid"]=>

          string(1) "1"

          ["q1"]=>

          string(5) "5.546"

          ["q2"]=>

          string(5) "5.546"

          ["q3"]=>

          string(5) "5.546"

        }

      }

      ["6.00 Index"]=>

      array(1) {

        [0]=>

        array(7) {

          ["regid"]=>

          string(3) "206"

          ["firstname"]=>

          string(6) "Ricki "

          ["lastname"]=>

          string(9) "Blackwell"

          ["eventid"]=>

          string(1) "1"

          ["q1"]=>

          string(5) "6.085"

          ["q2"]=>

          string(5) "6.085"

          ["q3"]=>

          string(5) "6.045"

        }

      }

      ["7.00 Index"]=>

      array(1) {

        [0]=>

        array(7) {

          ["regid"]=>

          string(3) "196"

          ["firstname"]=>

          string(4) "Adam"

          ["lastname"]=>

          string(8) "Stratton"

          ["eventid"]=>

          string(1) "1"

          ["q1"]=>

          string(5) "7.481"

          ["q2"]=>

          string(5) "7.440"

          ["q3"]=>

          string(5) "7.440"

        }

      }

    }

     

    Not what I'm after, almost like stabbing in the dark over here but I'm gonna keep trying until I figure something out (or get a little help?)

  7. $query2 = mysql_query("
    SELECT registrations.firstname, participants.eventid, registrations.lastname, participants.q1, participants.q2, participants.q3, participants.q1s, participants.q2s, participants.q3s, participants.q1rt, participants.q2rt, participants.q3rt, participants.regid
    FROM participants
    INNER JOIN registrations ON registrations.id = participants.regid
    WHERE participants.eventid = $_GET[event] AND registrations.class = '$var'") or DIE(mysql_error());
    if(mysql_num_rows($query)!=0){
    
    
    	while($r2=mysql_fetch_array($query2))
    	{
    
    $var2 = substr($var, 0, 4);
    
    if (($r2[q1] < $var2) && ($r2[q2] < $var2) && ($r2[q3] < $var2)) {
    $indexqpL = array($var => array(regid => "$r2[regid]",
                          firstname => "$r2[firstname]",
                          lastname => "$r2[lastname]",
                          eventid => "$r2[eventid]",
                          q1 => "$r2[q1]",
                          q2 => "$r2[q2]",
                          q3 => "$r2[q3]",
                        ));
                 											} else {
    $indexqpH = array($var => array(regid => "$r2[regid]",
                          firstname => "$r2[firstname]",
                          lastname => "$r2[lastname]",
                          eventid => "$r2[eventid]",
                          q1 => "$r2[q1]",
                          q2 => "$r2[q2]",
                          q3 => "$r2[q3]",
                        ));
                 												}
    
    
    	}
    
    }
    echo "<pre>";
    var_dump($indexqpH);
    echo "</pre>";

     

    This query resulted in these results:

     

    array(1) {

      ["4.70 Index"]=>

      array(7) {

        ["regid"]=>

        string(3) "217"

        ["firstname"]=>

        string(4) "Jeff"

        ["lastname"]=>

        string(9) "Wilkerson"

        ["eventid"]=>

        string(1) "1"

        ["q1"]=>

        string(5) "5.026"

        ["q2"]=>

        string(5) "4.902"

        ["q3"]=>

        string(5) "4.902"

      }

    }

     

    array(1) {

      ["5.30 Index"]=>

      array(7) {

        ["regid"]=>

        string(3) "207"

        ["firstname"]=>

        string(5) "Shawn"

        ["lastname"]=>

        string(8) "Mcdonald"

        ["eventid"]=>

        string(1) "1"

        ["q1"]=>

        string(5) "5.546"

        ["q2"]=>

        string(5) "5.546"

        ["q3"]=>

        string(5) "5.546"

      }

    }

     

    array(1) {

      ["6.00 Index"]=>

      array(7) {

        ["regid"]=>

        string(3) "206"

        ["firstname"]=>

        string(6) "Ricki "

        ["lastname"]=>

        string(9) "Blackwell"

        ["eventid"]=>

        string(1) "1"

        ["q1"]=>

        string(5) "6.085"

        ["q2"]=>

        string(5) "6.085"

        ["q3"]=>

        string(5) "6.045"

      }

    }

     

    array(1) {

      ["7.00 Index"]=>

      array(7) {

        ["regid"]=>

        string(3) "196"

        ["firstname"]=>

        string(4) "Adam"

        ["lastname"]=>

        string(8) "Stratton"

        ["eventid"]=>

        string(1) "1"

        ["q1"]=>

        string(5) "7.481"

        ["q2"]=>

        string(5) "7.440"

        ["q3"]=>

        string(5) "7.440"

      }

    }

     

     

    That's 1 person from each class, but there are a lot more than that. 4.70 has 10 people alone. I guess I'm not combining them and it keeps overwriting? I'm wanting to place each of those results IN TO the "class" array as its own index, hmm.. maybe I just need an extra array in the mix?

  8. Basically, the structure I'm trying to get is:

     

    $var = 'class name here';

    $indexqpH[$var][#][info]

     

    info being firstname, lastname, etc. The number to be the array index for each of said info. It's in a loop where $var will be set to 4 different things, so I should end up with 4 arrays that I can look at based on class.

  9. I just had it as an example of how I might use the information.

     

    		while($r2=mysql_fetch_array($query2))
    	{
    
    
    if (($r2[q1] < 4.70) && ($r2[q2] < 4.70) && ($r2[q3] < 4.70)) {
    $indexqpH = array( '$var' => array(array(regid => "$r2[regid]",
                          firstname => "$r2[firstname]",
                          lastname => "$r2[lastname]",
                          eventid => "$r2[eventid]",
                          q1 => "$r2[q1]",
                          q2 => "$r2[q2]",
                          q3 => "$r2[q2]",
                        )));
                 											} else {
    $indexqpL = array( '$var' => array(array(regid => "$r2[regid]",
                          firstname => "$r2[firstname]",
                          lastname => "$r2[lastname]",
                          eventid => "$r2[eventid]",
                          q1 => "$r2[q1]",
                          q2 => "$r2[q2]",
                          q3 => "$r2[q2]",
                        )));
                 												}
    
    
    	}
    
    }
    
    
    
    $count1 = count($indexqpH[$var]);
    $count2 = count($indexqpL[$var]);
    
    
    for ($i = 1; $i <= $count1; $i++) {
    $content .= "$indexqpH[$var][$i][firstname] $indexqpH[$var][$i][lastname]<br />";
    }
    

     

    I think I'm getting an endless loop here, when I refresh the page after uploading this it just sits and loads.

  10. In the database table for the articles you should have a column used to specifiy whether or not the article has been approved. Say, 0 for unapproved and 1 for approved. By default you can have this column set to 0. You can then create a simple page where you select all of the records from the database that are unapproved (approved = 0) so they can be approved by an administrator. The page that displays the articles would only select articles that have been approved.

     

     

    Thanks, That one rang a little bell in my head. I will try that.

    If anyone have any other answers. Please write them.

    I really appreciate it.

     

    Nope, that's how you should do it.

  11. $indexqpH[] = array(regid => "$r2[regid]",
                          firstname => "$r2[firstname]",
                          lastname => "$r2[lastname]",
                          eventid => "$r2[eventid]",
                          q1 => "$r2[q1]",
                          q2 => "$r2[q2]",
                          q3 => "$r2[q2]",
                        );

     

    This get's me an array that I should be able to call out by using $indexqpH[1][q1], $indexqpH[1][q2], etc. Right? I have one more variable I would like to set, somehow make it another dimension deep (can do that okay) but want to name it, not sure how? I know this is simple. So that I can have:

     

    $indexqpH[class1][1][q1]

    $indexqpH[class2][1][q1]

    $indexqpH[class2][2][q1]

    $indexqpH[class1][2][q1]

    $indexqpH[class3][1][q1]

     

    So I can do something similar to this.

     

  12. The code you posted, won't return a result like this:

    123

    4.764.784.72

    4.68 4.734.75

     

    I can see it checking each one or whatever but don't see how it brings the results based on the three rounds for each. I might be looking at it wrongly. I set up a separate table just for these that are done in this way. I have id, regid, eventid, round, et, rt, mph.

     

    regid = registered users id

    eventid = event id

    round = which round, possible options being: q1, q2, q3

    et = decimal

    rt = decimal

    mph = decimal

     

    The round time should actually be et+rt, but that shouldn't be hard to add in the end if I need to.

     

    I just did this:

    $query = mysql_query("SELECT
      p.regid, IF(above.et IS NOT NULL, above.et, below.et)
    FROM
      participants AS p
    LEFT JOIN
      (SELECT regid, MIN(et) AS et WHERE et >= 4.7 GROUP BY regid) AS above
    USING (regid)
    LEFT JOIN
      (SELECT regid, MAX(et) AS et WHERE et < 4.7 GROUP BY regid) AS below
    USING (participant_id)") or DIE(mysql_error());
    
    while($row=mysql_fetch_array($query)){
    
    echo "$row[et]";
    
    }
    

     

    just to see what I get, this query is going to have to be more specific as in class and event id, but with just this I got an error:

     

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE et >= 4.7 GROUP BY regid) AS above USING (regid) LEFT JOIN (SELECT regid' at line 6

     

  13. I changed this line:

    if ($qp == 1){ $arr1[1] = "$firstname $row[lastname]"; $arrid1[1] = "$row[id]"; $r1[1] = "$row[r1]"; $r1s[1] = "$row[r1s]"; $r1rt[1] = "$row[r1rt]"; }

     

    to this:

    if ($qp == 1){ if (($row[q1] != '99.999') OR ($row[q2] != '99.999') OR ($row[q3] != '99.999')) { mysql_query ("UPDATE participants SET qpts = '16' WHERE id = $row[id]") }  $arr1[1] = "$firstname $row[lastname]"; $arrid1[1] = "$row[id]"; $r1[1] = "$row[r1]"; $r1s[1] = "$row[r1s]"; $r1rt[1] = "$row[r1rt]"; }

     

    and now I get this error:

    Parse error: syntax error, unexpected T_VARIABLE in /home/orsca/public_html/pairings.php  on line 227

     

     

     

     

    edit: I noticed I had a space between mysql_query and (, removed the space and now I get:

     

    Parse error: syntax error, unexpected '}' in /home/orsca/public_html/pairings.php  on line 227

  14. Which is what I have already, I just have the information stored on 1 row instead of multiple. So instead of making a new table like you said, just change the method to 1 row per round per user?

     

    id | eventid | userid | round# | rt | et | speed

     

    have a unique id, event id, user id, round number, reaction time, et, and speed for each row.

    What does above. and below. refer to?

  15. If anything, I'd move the times to separate table

     

    table results

    ----------------------

    result_id, participant_id, run, time

    1,  1,  1,  4.76

    2,  1,  2,  4.78

    3,  1,  3,  4.72

    4,  2,  1,  4.68

    5,  2,  2,  4.73

    6,  2,  3,  4.75

    ....

     

    Then

     

    SELECT 
      p.participant_id, IF(above.time IS NOT NULL, above.time, below.time)
    FROM
      participants AS p
    LEFT JOIN
      (SELECT participant_id, MIN(time) AS time WHERE time >= 4.7 GROUP BY particpant_id) AS above
    USING (participant_id)
    LEFT JOIN
      (SELECT participant_id, MAX(time) AS time WHERE time < 4.7 GROUP BY particpant_id) AS below
    USING (participant_id)
    

     

    (not tested)

     

    Could you explain this? It looks like you're calling to 2 new tables, but said to add 1 and show 1 at the top. I think I can work with something like this as a workaround if I understand it a little more. Thanks

  16. What you just posted really got me confused. Advanced queries do that. If I go any sort of route that requires me changing the DB, then I'm also looking at having to change a lot of code for stuff that already exists. I could MAYBE do the 3 tables just for qualifying and just for the classes that require this special query, and leave the rest alone. *shrugs*

  17. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '&& cr >= '1' ORDER BY qp' at line 1

     

    $query = mysql_query("SELECT * FROM participants INNER JOIN registrations ON registrations.id = regid WHERE class = '$_GET[class]' && eventid = $_GET[event] && cr >= '1' ORDER BY qp") or DIE(mysql_error());

     

     

    edit: nvm, would this be caused by $_GET[class] not being set? It wasn't set in this one case when I got the message, when I set it, it was gone.

  18. I would love to slim it down to something very simple like you said, but the way the pairings are set up I couldn't figure it out. I had asked the person having me to do this to explain to me how the pairings are generated and he didn't know either. For that reason I wouldn't know any way to do it if I don't know where each qualify position is suppose to fall along with the byes. So I had to hard code each one to fill it in correctly.

     

    Beyond that, there is no reason why making a completely valid change from one line to the next should cause the page to go white and no errors to be displayed anyway. Everything is okay code. If you uploaded a file that just had echo "hello"; in it and it worked and just added another line that said echo "hello2"; and it then white paged, you would be in the same situation.

×
×
  • 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.