Jump to content

Only want to show 1 row


patsman77

Recommended Posts

Hello All,

 

I have a code that works but  I want to liit it to only show the row of the current user viewing the page. Can someone show me where I can make the change? Right now it spits out the results for all users, I just want it for the current user viewing the page.

 

<?php //Display picks for this user, highlight any correct ones.
      $total=$football->NumberOfGames($week);
// Get current date and time to determain if a game has started or not
      $date = date("m/d/Y");
      $time = date("H:i:s A");
      $datetime = $football->doDate($date,$time,$football->display_offset);

      $sql1="select * from ".$football->prefix."picks, ".$football->prefix."schedule where user = '".$username."' and week = ".$week." and ".$football->prefix."picks.gameid = ".$football->prefix."schedule.gameid order by ".$football->prefix."schedule.gametime, ".$football->prefix."schedule.gameid";
          $rs1 = $football->dbQuery($sql1);
          $rows = mysql_num_rows($rs1);
          if($rows > 0)
                {
          while($row1=mysql_fetch_object($rs1))
                {
          $pick=$row1->pick;
          $icon=$iconfile[$pick];
          $result=$row1->result;
          $sresults=$row1->sresults;
          $style = "\"border: .2em solid $color;\"";
          if($pick=="")
          {
            $pick="---";
          }
// check if system usisng spread
        $bcolor = "#006600";  // set win border color
        if ($football->usespread == "Y") {
           if ($pick != $result and $pick == $sresults) { $bcolor ="#006600"; }
          $result=$sresults;
          }

          if ($pick==$result)
          {
//            $pick="<strong>".$pick."</strong>";
            // Hack to see winner better from Mrtalk
            $pick="<font color='#0b7b0b' size=1pt><strong><B>".$pick."</B></strong></font>";
           // $style = "\"border: .2em solid $bcolor;\"";
          }
          
            if ($result=="TIE")
          {
//            $pick="<strong>".$pick."</strong>";
            // Hack to see winner better from Mrtalk
            $pick="<font color='#ff0000' size=1pt><strong><B>".$pick."</B></strong></font>";
           // $style = "\"border: .2em solid $bcolor;\"";
          }
          
         if ($member != $football->admin_username)
         {
//         $alllocked = $football->ckAlllocked($week);
//         if ($alllocked != true)
         if ($row1->gametime >= $datetime and $football->showPicks == "Y" and $member != $username) // has game already started
         {
         $pick="---";
         }
         }
         if ($pick=="---") {
          ?>
  <td><?php  echo $pick; ?></td>
<?php   }
        else {
                ?> <td>

              <?  if ($football->display_graphics == "Y" and $result!="TIE") {  ?>
                <image src = "images/<? echo $icon; ?>" width="20" style="<? echo $style; ?>" ?> width=20 style=<? echo $style; ?>><br>
              <? } ?>
            <?  if ($football->display_graphics == "Y" and $result=="TIE") {  ?>
                <image src = "images/<? echo $icon; ?>" width="20" style="<? echo $style1; ?>" ?> width=20 style=<? echo $style1; ?>><br>
              <? } ?>

               <? echo $pick; ?></td><?
        }
        }

 

Any help would be appreciated.

 

Patsman77

Link to comment
https://forums.phpfreaks.com/topic/204980-only-want-to-show-1-row/
Share on other sites

Here is the code before the provided code that defines $username

 

if($football->showPicks == "Y" or $member == $football->admin_username)
        {
        $sql="select * from ".$football->prefix."users where user != '".$football->admin_username."' order by user ASC";
        }
        else
        {
        $sql="select * from ".$football->prefix."users where user = '".$member."' order by user";
    }
  $rs = $football->dbQuery($sql);
        while($row=mysql_fetch_object($rs))
    {
      $username=$row->user;
      $uname=$row->user;
      if ($uname=="") {
         $uname=$username;
         }
      if (round($i/2)*2==$i)
      {
          $color = "#ffffff";
?>
<tr>
<?php  }
       else
      {
          $color = "#d0d0d0";
?>
<tr class="alt">
<?php }
      $i++;
?>

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.