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

Re: [phpXperts] got trouble in highlighting searched record

Expand Messages
  • $@!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 1 of 8 , Mar 4, 2009
    • 0 Attachment

      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 2 of 8 , Mar 8, 2009
      • 0 Attachment
        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.