Jump to content

Why are certain numbers being skipped?


anglerpages
Go to solution Solved by jcbones,

Recommended Posts

We have a new web administrator trying to edit code from the last person. Can you please help?

 

If you look at this page  http://www.fishska.com/pro13/   you will notice that numbers are skipped. All of the correct teams are showing up, but the automatically assigned number is skipped. For example, #5. 

 

The data is called from the same database used to populate this page:  http://www.fishska.com/points/Pro_points/=

 

so you can see that the teams are actually in the proper order, just the numbering is off.  We suspect something to do with the ads on line 300, but have not been successful troubleshooting.

 

I tried to attach a .txt file but it failed (16k)

 

 

{assign_variable:template_path="shared"}

 

{embed="shared/.global_header"}

    <title>Yamaha Professional Kingfish Tour Championship | Biloxi, Mississippi | 

 

November 4-6, 2013</title>

    <meta name="Description" content="Based in St Augustine, Florida. Contains 

 

membership benefits and policies, history, mercury tournament trail, yamaha pro tour, 

 

news, tournament results and corporate partners.">

    <link rel="stylesheet" type="text/css" href="/shared/reset.css" media="screen" />

    <link href='http://fonts.googleapis.com/css?family=Open

 

+Sans:300,300italic,400,400italic,600,600italic,700,700italic,800,800italic' 

 

rel='stylesheet' type='text/css'>

    <link rel="stylesheet" type="text/css" href="/shared/text.css" media="screen" />

    <link rel="stylesheet" type="text/css" href="/shared/960.css" media="screen" />

    <link rel="stylesheet" type="text/css" href="/shared/layout.css" media="screen" />

    <link rel="stylesheet" type="text/css" href="/pro12/layout.css" media="screen" />

    <link rel="stylesheet" type="text/css" href="/shared/nav.css" />

    <link rel="stylesheet" type="text/css" href="/pro13/nav.css" />

    <!--[if IE 6]><link rel="stylesheet" type="text/css" href="/shared/ie6.css" 

 

media="screen" /><![endif]-->

    <!--[if IE 7]><link rel="stylesheet" type="text/css" href="/shared/ie.css" 

 

media="screen" /><![endif]-->

    <script type="text/javascript" src="/shared/jquery-1.3.2.min.js"></script>

    <script type="text/javascript" src="/shared/jquery-ui.js"></script>

    <script type="text/javascript" src="/shared/jquery-fluid16.js"></script>

    <script type="text/javascript" src="/shared/jquery-tools.js"></script>

    <script type="text/javascript" src="/shared/jquery-cycle.js"></script>

    <script type="text/javascript">

      $(document).ready(function() {

      $('.slideshow').cycle({

        fx: 'fade'

      });

      });

    </script>

    <script type="text/javascript">

      $(document).ready(function() {

      $('.ruggedShark').cycle({

        fx: 'fade'

      });

      });

    </script>

    <script type="text/javascript">

      $(document).ready(function() {

      $('.slideshow2').cycle({

        fx: 'scrollDown' 

      });

      });

    </script>

    <script type="text/javascript">

      $('#shuffle_featured').cycle({ 

      fx: 'custom', 

      sync: 0, 

      pause: 1,

      pager:  '#nav', 

      pagerAnchorBuilder: function(idx, slide) { 

        return '#nav li:eq(' + idx + ') a'; 

      },

      cssBefore: {  

        top:  0, 

        left: 400, 

        display: 'block' 

      }, 

      animIn:  { 

        left: 0 

      }, 

      animOut: {  

        top: 400 

      }, 

      delay: -1000 

      });

    </script>

    <script type="text/javascript">

      $(document).ready(function() {

      $("#chained").scrollable().navigator().mousewheel()});

    </script>

    <script type="text/javascript">

      $(document).ready(function() {

      $("img[rel]").overlay();

      });

    </script>

  <style>

  body,p  {font-size:15px;}

div.teamName {font-size:2.25em; color:#bcad01;}

div.totalPoints {font-size:2.25em; color:#bcad01; float:right;}

.leftCol, .rightCol, .bio, .types {padding:5px;}

.leftCol, .rightCol {width:45%;}

.leftCol {float:left;}

.rightCol {float:right;}

b {color:#168bcb;}

.bio h2 {color:#cccccc; text-align:center; }

.rounded {

  -webkit-border-radius: 6px;

  -moz-border-radius: 6px;

  border-radius: 6px;

}

</style>

  </head>

  <body>

    <div class="container_16" id="leaderboard">

    {embed="pro13/.global_header"}

<!--<div class="grid_16" style="position:relative;">

  <img src="/resources/2012/pros/trophyBackground.jpg">

  <div style="position:absolute; right:0px; top:20px; z-index:2; text-align:right;">

    <img src="/resources/2012/pros/Quest1.jpg">

  </div>

</div>-->

<div class="clear"></div> 

<div class="grid_16" style="border-bottom:1px solid #fff; text-align:center;"><span 

 

style="font-size:2em;">Professional Kingfish Tour Championship</span><br> <!--<strong 

 

style="color:#bd0000; font-size:10em; line-height:1em;">INTENSE</strong>-->

<!--<object id="vp13r1Oc" width="854" height="480" classid="clsid:d27cdb6e-ae6d-11cf-

 

96b8-444553540000"><param name="movie" value="http://static.animoto.com/swf/w.swf?

 

w=swf/vp1&e=1352411663&f=3r1Oc6Sf4Ux2oNol1jA9kQ&d=178&m=p&r=360p

 

+480p&volume=50&start_res=360p&i=m&options="></param><param name="allowFullScreen" 

 

value="true"></param><param name="allowscriptaccess" value="always"></param><embed 

 

id="vp13r1Oc" src="http://static.animoto.com/swf/w.swf?

 

w=swf/vp1&e=1352411663&f=3r1Oc6Sf4Ux2oNol1jA9kQ&d=178&m=p&r=360p

 

+480p&volume=50&start_res=360p&i=m&options=" type="application/x-shockwave-flash" 

 

allowscriptaccess="always" allowfullscreen="true" width="854" 

 

height="480"></embed></object>-->

</div>

<div class="clear"></div>

<div class="grid_16"><img src="/resources/2012/pros/ChampionshipWebsite13.png"></div>

<div class="grid_8" style="text-align:center;">

<!--<iframe width="420" height="315" src="http://www.youtube.com/embed/koYXlgIo9yA" 

 

frameborder="0" allowfullscreen></iframe>-->

</div>

<div class="clear"></div>

 

<?php

global $IN;

$a = "2013_pros_list";

$b = "2013_pros";

$c = "ska_points_tour_2013";

$key = "team_id";

$type = "PRO";

 

$query = "SELECT * FROM $a 

            LEFT JOIN $c ON ($c.$key=$a.$key) 

            LEFT JOIN $b ON ($b.$key=$a.$key) 

            ORDER BY `total` DESC LIMIT 1";

          

  $result = mysql_query($query) or die(mysql_error());

  while($row = mysql_fetch_array($result)){  

  $str = $row['type'];

  $exclude_list = array("LADIES","JUNIOR","SENIOR");

  if(!in_array($str, $exclude_list)){          

  

  if ($row['alternate_layout'] == "0") {

    $minHeight = "725";

  } elseif ($row['alternate_layout'] == "1") {

    $minHeight = "600";

    echo "<div class=\"clear\"></div><hr>";

  } elseif ($row['alternate_layout'] == "2") {

    $minHeight = "500";

    echo "<div class=\"clear\"></div><hr>";

  }

  ?>

    <div class="grid_12 prefix_2" style="min-height:<?php echo $minHeight; ?>px;">

 

      <div class="teamName">

        1. <b>

        <?php 

        if ($row['teamname']){

          echo $row['teamname'];

        } else {

          echo $row['prefix']." ".$row['team_name'];

        }

        ?>

        </b>

      </div>

      

        <?php

        if ($row['alternate_layout'] == "0" OR $row['alternate_layout'] == "") {

        ?>

        <div class="totalPoints"><?php echo $row['total'];?></div>

        <?php

        }

        ?>

      <div class="slideshow2" style="text-align:center;">

      <?php

      if (!$row['photo']) {

        echo "<img src=\"/resources/2012/images/tour/bios/_noPhoto.jpg\">";

      } else {

        echo "<img src=\"/resources/2012/images/tour/teams/".$row['photo'].".jpg\" 

 

class=\"rounded\">";

      }

      if ($row['photo2']) { echo "<img src=\"/resources/2012/images/tour/teams/".$row

 

['photo2'].".jpg\" class=\"rounded\">"; }

      if ($row['photo3']) { echo "<img src=\"/resources/2012/images/tour/teams/".$row

 

['photo3'].".jpg\" class=\"rounded\">"; }

      if ($row['photo4']) { echo "<img src=\"/resources/2012/images/tour/teams/".$row

 

['photo4'].".jpg\" class=\"rounded\">"; }

      ?>

      </div>

      <br clear="both">

      <div class="leftCol">

      <?php

      if ($row['boat_make']) {

        if ($row['boat_make']){

          echo "<b>Boat Brand:</b> " . $row['boat_make']."<br>";

        }

        if ($row['motors']){

          echo "<b>Motors:</b> " . $row['motors']."<br>";

        }

        if ($row['trailer']){

          echo "<b>Trailer:</b> " . $row['trailer']."<br>";

        }

          if ($row['captains_name']) {

            echo "<b>Captain:</b> ".$row['captains_name']."<br>".$row

 

['captain_location']; 

          } else {

            echo "<b>Captain:</b> ".$row['captain_name']."<br>";

          }

      }

      ?>

      </div>

      <div class="rightCol">

      <?

      if ($row['team_members']){

        echo "<b>Teammates:</b><br> " . $row['team_members']."<br>";

      }

      ?>

      </div>

      <div class="clear"></div>

      <div class="bio">

      <?php

      if (!$row['boat_make']) {

        echo "<h2>Biography Coming Soon</h2>";

      } else {

        if ($row['alternate_layout'] == "0" OR $row['alternate_layout'] == "1"){

          if ($row['sponsors']){

            echo "<b>Sponsors:</b> " . $row['sponsors']."<br><br>";

          }

          if ($row['alternate_layout'] == "0"){

            if ($row['accomplishments']){

              echo "<b>Accomplishments:</b> " . $row['accomplishments']."<br>";

            }

          }

        }

      }

      ?>

      </div>

    </div>

    <?php

    

    if ($row['alternate_layout'] == "1" OR $row['alternate_layout'] == "2") {

    ?>

    <div class="grid_8" style="min-height:<?php echo $minHeight; ?>px;">

      <div class="teamName">

        <b> </b>

        <span style="float:right;"><?php echo $row['total'];?></span>

      </div>

      <div class="bio">

       <?php

         if ($row['alternate_layout'] == "2"){

            echo "<b>Sponsors:</b> " . $row['sponsors']."<br><br>";

         }

         echo "<b>Accomplishments:</b> " . $row['accomplishments']."<br>";

       ?>

      </div>

    </div>

    <hr>

    <?php

    }

  }

}

?>

<div class="clear"></div>

<div class="grid_16"><br><br></div>

<div class="clear"></div>

 

 

<?php

 

$yamahaAd = "kwazar0";

$contenderAd = "intense0";

$raymarineAd = "crisis0";

 

  $query = "SELECT * FROM $a 

            LEFT JOIN $c ON ($c.$key=$a.$key) 

            LEFT JOIN $b ON ($b.$key=$a.$key) 

            ORDER BY `total` DESC LIMIT 1,150";

 

  $place = "1";

  $result = mysql_query($query) or die(mysql_error());

  while($row = mysql_fetch_array($result)){ 

  $place++; 

  $str = $row['type'];

  $exclude_list = array("LADIES","JUNIOR","SENIOR");

  if(!in_array($str, $exclude_list)){          

  

  if ($row['alternate_layout'] == "0") {

    $minHeight = "700";

  } elseif ($row['alternate_layout'] == "1") {

    $minHeight = "600";

    echo "<div class=\"clear\"></div><hr>";

  } elseif ($row['alternate_layout'] == "2") {

    $minHeight = "500";

    echo "<div class=\"clear\"></div><hr>";

  }

  ?>

    <div class="grid_8" style="min-height:<?php echo $minHeight; ?>px;">

 

      <div class="teamName">

        <?php echo $place; ?>. <b>

        <?php 

        if ($row['teamname']){

          echo $row['teamname'];

        } else {

          echo $row['prefix']." ".$row['team_name'];

        }

        ?>

        </b>

      </div>

      

        <?php

        if ($row['alternate_layout'] == "0" OR $row['alternate_layout'] == "") {

        ?>

        <div class="totalPoints"><?php echo $row['total'];?></div>

        <?php

        }

        ?>

      <div class="slideshow2">

      <?php

      if (!$row['photo']) {

        echo "<img src=\"/resources/2012/images/tour/bios/_noPhoto.jpg\" style=

 

\"width:460px; height:247px;\" class=\"rounded\">";

      } else {

        echo "<img src=\"/resources/2012/images/tour/teams/".$row['photo'].".jpg\" 

 

style=\"width:460px; height:247px;\" class=\"rounded\">";

      }

      if ($row['photo2']) { echo "<img src=\"/resources/2012/images/tour/teams/".$row

 

['photo2'].".jpg\" style=\"width:460px; height:247px;\" class=\"rounded\">"; }

      if ($row['photo3']) { echo "<img src=\"/resources/2012/images/tour/teams/".$row

 

['photo3'].".jpg\" style=\"width:460px; height:247px;\" class=\"rounded\">"; }

      if ($row['photo4']) { echo "<img src=\"/resources/2012/images/tour/teams/".$row

 

['photo4'].".jpg\" style=\"width:460px; height:247px;\" class=\"rounded\">"; }

      ?>

      </div>

      <br clear="both">

      <div class="leftCol">

      <?php

      if ($row['boat_make']) {

        if ($row['boat_make']){

          echo "<b>Boat Brand:</b> " . $row['boat_make']."<br>";

        }

        if ($row['motors']){

          echo "<b>Motors:</b> " . $row['motors']."<br>";

        }

        if ($row['trailer']){

          echo "<b>Trailer:</b> " . $row['trailer']."<br>";

        }

          if ($row['captains_name']) {

            echo "<b>Captain:</b> ".$row['captains_name']."<br>".$row

 

['captain_location']; 

          } else {

            echo "<b>Captain:</b> ".$row['captain_name']."<br>";

          }

      }

      ?>

      </div>

      <div class="rightCol">

      <?

      if ($row['team_members']){

        echo "<b>Teammates:</b><br> " . $row['team_members']."<br>";

      }

      ?>

      </div>

      <div class="clear"></div>

      <div class="bio">

      <?php

      if (!$row['boat_make']) {

        echo "<h2>Biography Coming Soon</h2>";

      } else {

        if ($row['alternate_layout'] == "0" OR $row['alternate_layout'] == "1"){

          if ($row['sponsors']){

            echo "<b>Sponsors:</b> " . $row['sponsors']."<br><br>";

          }

          if ($row['alternate_layout'] == "0"){

            if ($row['accomplishments']){

              echo "<b>Accomplishments:</b> " . $row['accomplishments']."<br>";

            }

          }

        }

      }

      ?>

      </div>

    </div>

    

   <?php

    if ($row['photo'] == "$yamahaAd") {

    ?>

    <div class="grid_8"><img src="/resources/2012/images/tour/bios/YamahaAd.jpg" 

 

class="rounded"></div>

    <?php

    }

    

    if ($row['photo'] == "$contenderAd") {

    ?>

    <div class="grid_8"><img src="/resources/2012/images/tour/bios/ContenderAd.jpg" 

 

class="rounded"></div>

    <?php

    }

    

    if ($row['photo'] == "$raymarineAd") {

    ?>

    <div class="clear"></div><div class="grid_16" style="color:#333;text-

 

align:center;font-size:2em;"><hr>End of Paid Places<hr></div><div class="clear"></div>

    <?php

    }

    

    if ($row['alternate_layout'] == "1" OR $row['alternate_layout'] == "2") {

    ?>

    <div class="grid_8" style="min-height:<?php echo $minHeight; ?>px;">

      <div class="teamName">

        <b> </b>

        

      </div>

      

        <div class="totalPoints"><?php echo $row['total'];?></div>

        <br clear="both">

      <div class="bio">

       <?php

         if ($row['alternate_layout'] == "2"){

            echo "<b>Sponsors:</b> " . $row['sponsors']."<br><br>";

         }

         echo "<b>Accomplishments:</b> " . $row['accomplishments']."<br>";

       ?>

      </div>

    </div>

    <hr>

    <?php

    }

  }

}

?>

<div class="clear"></div>

    {embed="pro12/.global_footer"}

 

  </body>

</html>

Link to comment
Share on other sites

  • Solution

What I see, is this:

 

$place = "1"; //create variable assigning it the number 1: should not be in quotes, but will work that way.
  $result = mysql_query($query) or die(mysql_error());
  while($row = mysql_fetch_array($result)){ 
  $place++; //increment the number.
  $str = $row['type'];
  $exclude_list = array("LADIES","JUNIOR","SENIOR");
  if(!in_array($str, $exclude_list)){        

 

You are incrementing the variable $place, BEFORE checking to see if you are going to exclude the row.  You should do it AFTER you make sure the row is NOT EXCLUDED.

Link to comment
Share on other sites

jcbones,

Thank you! That worked, of course and our numbering issue is solved. However, we are getting duplicates. 

Key "team_id" can appear in a record that is type LADIES   SENIOR   JUNIOR   PRO

We only want to call records that are type = PRO and thought that the code below accomplished that.

However, we are getting duplicates if the Key "team_id" is the same in a record type=PRO and in a record type=SENIOR

What are we missing?

 

 

<?php

global $IN;

$a = "2013_pros_list";

$b = "2013_pros";

$c = "ska_points_tour_2013";

$key = "team_id";

$type = "PRO";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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