Loading ...
Sorry, an error occurred while loading the content.
 

Re: [phpXperts] got trouble in highlighting searched record

Expand Messages
  • Mety Soriano
    this is my codes, im new in php   while ($row = mysql_fetch_array($checker_open))              {              echo ;
    Message 1 of 8 , Mar 4, 2009
      this is my codes, im new in php
       
      while ($row = mysql_fetch_array($checker_open)) 
           
            {
            
            echo "</tr>";
             ?>
              <!-- SECOND LINE -->    
              <tr bgcolor="#EEEEEE">
              <!-- SECOND LINE -->  
              
              <td><div align="center"><font face="Arial" size="2"><?php echo         
              $row['sowno_source']; ?></font></div></td> 
              
              <td><div align="center"><font face="Arial" size="2"><?php echo         
              $row['date_farrow']; ?></font></div></td> 
              
              <td><div align="center"><font face="Arial" size="2"><?php echo         
              $row['iron']; ?></font></div></td> 
              

       
      METY  R. SORIANO
      IT Administrator
      Sacred Heart College
      1 Merchan Street
      Lucena City, Quezon
      Philippines

      (+63)9282860545
      (042)3736167
      http://www.shc.edu.ph


      --- On Wed, 4/3/09, $@!ful™ <anm.saiful@...> wrote:
      From: $@!ful™ <anm.saiful@...>
      Subject: Re: [phpXperts] got trouble in highlighting searched record
      To: phpexperts@yahoogroups.com
      Date: Wednesday, 4 March, 2009, 4:34 PM

      You can try with this following code. I did not run it, so you may consider it as pseudo code.

      function display_output( $highlight_date_ list, $date )
      {
          echo '<td', in_array($date, $highlight_ date_list) ?' style="color: red">'.$date.'</td>' :'>'.$date.'</td>';
      }

       

      $highlight_date_ list = array( '03/04/09', '05/06,09' );

       

      echo '<table border=0>';
      while ($row = mysql_fetch_ object($result) ) {
          echo '<tr>';
          display_output( $row->date1 );
          display_output( $row->date2 );
          display_output( $row->date3 );
          echo '<tr>';
      }
      echo '</table>'; 

       

      CHECKMATE - PLAY with PROBLEMS



      From: metysoriano <metysoriano@ yahoo.com>
      To: phpexperts@yahoogro ups.com
      Sent: Wednesday, March 4, 2009 11:48:07 AM
      Subject: [phpXperts] got trouble in highlighting searched record

      I have 15 colums fields. Each column contains date. For example I want to search 03/04/09 date, then once it is on the row it will display regardless what colum it is.. my problem is this, I want to highlight its either changing color or change into fontsize the date 03/04/09, so that I could see immediately the date. Because if I can not highlight the search date I need to read each column where the date belongs to. I need to scroll right slowly, it takes time to read each row..

      Please help..

      Thank you so much




      Get your preferred Email name!
      Now you can @... and @....
    • Arunjyoti Das
      Hello METY R. SORIANO , I think the following code will illustrate you how to change the background of the column which holds the date of the search-item.
      Message 2 of 8 , Mar 4, 2009
        Hello  METY  R. SORIANO ,

        I think the following code will illustrate you how to change the background of the column which holds the date of the search-item.

        Here I am testing "last_login" ,which is a date type of the user's last login with your searched date (i.e. $searchedItem).

        <?php
                $query="select * from registration where 1";
                $result=@mysql_query($query) or die(mysql_error());
                while ($myrow = mysql_fetch_array($result))
                {
                $emails[]=$myrow["email"];
                $fnames[]=$myrow["fname"];
                $lnames[]=$myrow["lname"];
                $states[]=$myrow["state"];
                $store_ids[]=$myrow["store_id"];
                $last_logins[]=$myrow["last_login"];
                }
                ?>
                <!-- result area starts here -->
                <?php for($i=0;$i<count($emails);$i++){?>
                    <div class="grid_title" id="result<?=$i?>" style="background-color:<?php if($last_logins[$i]==$searchItem)echo "#F8F8F8";else echo "white";?>">
                       
                        <div style="float:left;width:200px;"><?php echo $emails[$i];?>
                        </div>       
                        <div style="float:left;width:130px;"><?php echo $fnames[$i]." ".$lnames[$i];?>
                        </div>
                        <div style="float:left;width:90px;"><?php echo $last_logins[$i];?>
                        </div>
                        <div style="float:left;width:70px;">
                            <?php echo $store_ids[$i];?>
                        </div>       
                        <div class="small"><?php if($states[$i]) echo $states[$i]; else echo "N/A";?>
                        </div>
                   
                       
                    </div>
                    <?php }?>
                <!-- result area ends here -->

        Regards,
        Arunjyoti Das
        Guwahati,
        India

        From: Mety Soriano <metysoriano@...>
        To: phpexperts@yahoogroups.com
        Sent: Wednesday, 4 March, 2009 2:23:08 PM
        Subject: Re: [phpXperts] got trouble in highlighting searched record

        I am using php sir. 
        where do I insert the variable..
         


         
        METY  R. SORIANO
        IT Administrator
        Sacred Heart College
        1 Merchan Street
        Lucena City, Quezon
        Philippines

        (+63)9282860545
        (042)3736167
        http://www.shc. edu.ph


        --- On Wed, 4/3/09, 9el <doctortomorrow@ gmail.com> wrote:
        From: 9el <doctortomorrow@ gmail.com>
        Subject: Re: [phpXperts] got trouble in highlighting searched record
        To: phpexperts@yahoogro ups.com
        Date: Wednesday, 4 March, 2009, 3:15 PM

        a simple trick can be  setting a flag like  $searched=false;
        then  after the search use $searched=true
        if ($searched) {
        background-color= new color
        }

        You can either use JavaScript or PHP for this.


        ------------ --------- --------- --------- --------- --------- --------- -----
        Use FreeOpenSourceSoftw ares, Stop piracy, Let the developers live. Get
        a Free CD of Ubuntu mailed to your door without any cost. Visit :
        www.ubuntu.com
        ------------ --------- --------- --------- --------- --------- --------- ----


        On Wed, Mar 4, 2009 at 11:48 AM, metysoriano <metysoriano@ yahoo.com> wrote:
        I have 15 colums fields. Each column contains date. For example I want to search 03/04/09 date, then once it is on the row it will display regardless what colum it is.. my problem is this, I want to highlight its either changing color or change into fontsize the date 03/04/09, so that I could see immediately the date. Because if I can not highlight the search date I need to read each column where the date belongs to. I need to scroll right slowly, it takes time to read each row..

        Please help..

        Thank you so much




        Get your new Email address!
        Grab the Email name you've always wanted before someone else does!



        Add more friends to your messenger and enjoy! Invite them now.
      • $@!ful™
        Analyze the following script carefully. I hope it will help you.   After executing the script, if a highlighted date found in any row then the row’s
        Message 3 of 8 , Mar 4, 2009

          Analyze the following script carefully. I hope it will help you.

           

          After executing the script, if a highlighted date found in any row then the row’s background color will be changed.

           
          function highlighted_date_exists( $higilight_date_list, $date_list )
          {
              foreach( $date_list as $date ) {
                  if( is_array( $date, $higilight_date_list ) ) {
                      return TRUE;
                  }
              }
              return FALSE;
          }
           
          $higilight_date_list = array( '03/06/09', '03/08/09' );
           
          while( $row = mysql_fetch_array($checker_open) )
          {
              echo highlighted_date_exists( $higilight_date_list, array($row['sowno_ source'],$row['date_farrow' ],$row['iron']) ) ? '<tr bgcolor="#EEEEEE">': '<tr>';
              echo '<td><div align="center"><font face="Arial" size="2">'.$row['sowno_ source'].'</font></div></td>';
              echo '<td><div align="center"><font face="Arial" size="2">'.$row['iron'].'</font></div></td>';
              echo '<td><div align="center"><font face="Arial" size="2">'.$row['sowno_ source'].'</font></div></td>';
              echo '</tr>';
          }
          CHECKMATE - PLAY with PROBLEMS



          From: Mety Soriano <metysoriano@...>
          To: phpexperts@yahoogroups.com
          Sent: Wednesday, March 4, 2009 2:59:34 PM
          Subject: Re: [phpXperts] got trouble in highlighting searched record

          this is my codes, im new in php
           
          while ($row = mysql_fetch_ array($checker_ open)) 
               
                {
                
                echo "</tr>";
                 ?>
                  <!-- SECOND LINE -->    
                  <tr bgcolor="#EEEEEE">
                  <!-- SECOND LINE -->  
                  
                  <td><div align="center"><font face="Arial" size="2"><?php echo         
                  $row['sowno_ source']; ?></font></div></td> 
                  
                  <td><div align="center"><font face="Arial" size="2"><?php echo         
                  $row['date_farrow' ]; ?></font></div></td> 
                  
                  <td><div align="center"><font face="Arial" size="2"><?php echo         
                  $row['iron'] ; ?></font></div></td> 
                  

           
          METY  R. SORIANO
          IT Administrator
          Sacred Heart College
          1 Merchan Street
          Lucena City, Quezon
          Philippines

          (+63)9282860545
          (042)3736167
          http://www.shc. edu.ph

          .

        • Mety Soriano
          Sorry SIr, it is still not running...   below is my whole codes, I do not know wat is lacking in my codes, I applied your codes, it was stack on is_array
          Message 4 of 8 , Mar 8, 2009
            Sorry SIr, it is still not running...
             
            below is my whole codes, I do not know wat is lacking in my codes, I applied your codes, it was stack on is_array code..
             
            ****************************
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
            <title>Saving Record</title>
            </head>
            <body bgcolor="#ddffdd">
            <table width="50%" border="0" align="center">
              <tr>
                <td>
             <form name="mety" method="post" action="http://202.71.180.139/site07/testing/snhf/test.php" />
            <input type="text" name="checker" />
            <input type="submit" value="Check This Date" />
            </form>
             
             </td>
              </tr>
            </table>

            <?php
             

                 $checker = $_POST['checker'];
              $sowno_source = $_POST['sowno_source'];
              $iron = $_POST['iron'];
              $myco_lac = $_POST['myco_lac'];
             if ($checker)
             {
              $dbaseconnect = mysql_connect("localhost","metysoriano","mety1124") or die ("Can not connect   Database");
              mysql_select_db(snhf,$dbaseconnect) or die ("No database Found");

              $save = "SELECT * FROM snhf_table WHERE iron = '$checker' OR myco_lac = '$checker' OR
              castration = '$checker' OR iron_follow = '$checker' OR myco_follow = '$checker' OR vit_b =
              '$checker' OR weaning = '$checker' OR nutrilac = '$checker' OR deworm = '$checker' OR
              n_start = '$checker' OR hog_cho = '$checker' OR n_grow = '$checker' OR n_big = '$checker' OR   disposal = '$checker'";
              
              $checker_open = mysql_db_query(snhf,$save,$dbaseconnect);
              
               if ($checker_open)
               
               {   
               ?>
               <table width="225%" border="1" align="center">
                 <!-- FIRST LINE -->
                    <tr bgcolor="#DDDDDD">
                 <!-- FIRST LINE -->
             
                    <td width="10%"><font face="Georgia" size="2"><div align="center">SOW # / SOURCE
                 </div></td>
                 
                 <td width="8%"><font face="Georgia" size="2"><div align="center">DATE FARROWED
                 </div></td>
                 
                 <td width="5%"><font face="Georgia" size="2"><div align="center">IRON
                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(3)</div></td>
                 
                 <td width="5%"><font face="Georgia" size="2"><div align="center">MYCOPLASMA /
                 LAC (7)</div></td>
                 
                 <td width="5%"><font face="Georgia" size="2"><div align="center">CASTRATION (10)
                 </div></td>
                 
                 <td width="5%"><font face="Georgia" size="2"><div align="center">IRON FOLLOW
                 (15)</div></td>
                 
                 <td width="5%"><font face="Georgia" size="2"><div align="center">MYCO FOLLOW
                 (21)</div></td>
                 
                 <td width="5%"><font face="Georgia" size="2"><div align="center">VIT_B&nbsp;
                 (25)</div></td>
                 
                 <td width="5%"><font face="Georgia" size="2"><div align="center">WEANING (30)</
                 div></td>
                 
                 <td width="5%"><font face="Georgia" size="2"><div align="center">N_LAC (36)
                 </div></td>
                 
                 <td width="5%"><font face="Georgia" size="2"><div align="center">DEWORM (45)</
                 div></td>
                 
                 <td width="5%"><font face="Georgia" size="2"><div align="center">N_START (55)</
                 div></td> 
                   
                 <td width="5%"><font face="Georgia" size="2"><div align="center">ANTI HOG CHO
                 (60)</div></td>
                    
                 <td width="5%"><font face="Georgia" size="2"><div align="center">N_GROW (90)</
                 div></td>
                   
                 <td width="5%"><font face="Georgia" size="2"><div align="center">N_BIG (120)</
                 div></td>
                 
                 <td width="5%"><font face="Georgia" size="2"><div align="center">DISPOSAL (150)
                 </div></td>
                 
                <?php
                  
                  
                while ($row = mysql_fetch_array($checker_open))
                
                    {
                 
                      echo "</tr>";
                        ?>
                       <!-- SECOND LINE -->    
                       <tr bgcolor="#EEEEEE">
                       <!-- SECOND LINE --> 
                   
                 
                 <td><div align="center"><font face="Arial" size="4"><?php echo        
                       $row['sowno_source']; ?></font></div></td>
                   
                       <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['date_farrow' ]; ?></font></div></td>
                   
                       <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['iron'] ; ?></font></div></td>
                 
                   <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['myco_lac'] ; ?></font></div></td>
                 
                 <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['castration'] ; ?></font></div></td>
                 
                 <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['iron_follow'] ; ?></font></div></td>
                 
                 <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['myco_follow'] ; ?></font></div></td>
                 
                 
                 <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['vit_b'] ; ?></font></div></td>
                 
                 <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['weaning'] ; ?></font></div></td>
                 
                 <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['nutrilac'] ; ?></font></div></td>
                 
                 <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['deworm'] ; ?></font></div></td>
               
                 <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['n_start'] ; ?></font></div></td>
                 
                 <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['hog_cho'] ; ?></font></div></td>
                 
                 <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['n_grow'] ; ?></font></div></td>
                 
                 <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['n_big'] ; ?></font></div></td>
                 
                 <td><div align="center"><font face="Arial" size="2"><?php echo        
                       $row['disposal'] ; ?></font></div></td>
               
               <?php
               
               }
                ?>
               </tr>
               </table>
               
                       
               <?php
                mysql_query($save);
                mysql_close($dbaseconnect); 
             
              }
              
             
             }
             
              
             ?>
            </body>
            </html>
            ************************************
             


             
            METY  R. SORIANO
            IT Administrator
            Sacred Heart College
            1 Merchan Street
            Lucena City, Quezon
            Philippines

            (+63)9282860545
            (042)3736167
            http://www.shc.edu.ph


            --- On Wed, 4/3/09, $@!ful™ <anm.saiful@...> wrote:
            From: $@!ful™ <anm.saiful@...>
            Subject: Re: [phpXperts] got trouble in highlighting searched record
            To: phpexperts@yahoogroups.com
            Date: Wednesday, 4 March, 2009, 6:25 PM

            Analyze the following script carefully. I hope it will help you.

             

            After executing the script, if a highlighted date found in any row then the row’s background color will be changed.

             
            function highlighted_ date_exists( $higilight_date_ list, $date_list )
            {
                foreach( $date_list as $date ) {
                    if( is_array( $date, $higilight_date_ list ) ) {
                        return TRUE;
                    }
                }
                return FALSE;
            }
             
            $higilight_date_ list = array( '03/06/09', '03/08/09' );
             
            while( $row = mysql_fetch_ array($checker_ open) )
            {
                echo highlighted_ date_exists( $higilight_date_ list, array($row[' sowno_ source'],$row[ 'date_farrow' ],$row['iron' ]) ) ? '<tr bgcolor="#EEEEEE">': '<tr>';
                echo '<td><div align="center"><font face="Arial" size="2">'.$row['sowno_ source'].'</font></div></td>';
                echo '<td><div align="center"><font face="Arial" size="2">'.$row['iron' ].'</font></div></td>';
                echo '<td><div align="center"><font face="Arial" size="2">'.$row['sowno_ source'].'</font></div></td>';
                echo '</tr>';
            }
            CHECKMATE - PLAY with PROBLEMS



            From: Mety Soriano <metysoriano@ yahoo.com>
            To: phpexperts@yahoogro ups.com
            Sent: Wednesday, March 4, 2009 2:59:34 PM
            Subject: Re: [phpXperts] got trouble in highlighting searched record

            this is my codes, im new in php
             
            while ($row = mysql_fetch_ array($checker_ open)) 
                 
                  {
                  
                  echo "</tr>";
                   ?>
                    <!-- SECOND LINE -->    
                    <tr bgcolor="#EEEEEE">
                    <!-- SECOND LINE -->  
                    
                    <td><div align="center"><font face="Arial" size="2"><?php echo         
                    $row['sowno_ source']; ?></font></div></td> 
                    
                    <td><div align="center"><font face="Arial" size="2"><?php echo         
                    $row['date_farrow' ]; ?></font></div></td> 
                    
                    <td><div align="center"><font face="Arial" size="2"><?php echo         
                    $row['iron'] ; ?></font></div></td> 
                    

             
            METY  R. SORIANO
            IT Administrator
            Sacred Heart College
            1 Merchan Street
            Lucena City, Quezon
            Philippines

            (+63)9282860545
            (042)3736167
            http://www.shc. edu.ph
            .



            New Email addresses available on Yahoo!
            Get the Email name you've always wanted on the new @ymail and @rocketmail.
            Hurry before someone else does!
          Your message has been successfully submitted and would be delivered to recipients shortly.
          »
          «