Advertisement
gitlez

YA: Output Row Style Switching 20120715093420AAwNyGv

Jul 15th, 2012
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. <?php
  2.  
  3. $mod = true;
  4. $storeFields = Array('store_code','store_name','location','storein_charge','store_keeper','astore_keeper','address','contact_no','email');
  5. echo '<tbody id="search_result_body">';
  6. foreach($stores as $store){
  7.     $mod = !$mod;
  8.     if($mod){
  9.         $style = ' style="background-color: red;"';
  10.     }else{
  11.         $style = '';
  12.     }
  13.     echo '<tr>' . PHP_EOL;
  14.     foreach($storeFields as $field){
  15.         echo "<td" .  $style . ">" . $store->$field . "</td>" . PHP_EOL;
  16.     }
  17.     echo '</tr>' . PHP_EOL;
  18. }
  19.  
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement