php - Need a function for a dynamic table -


i'm learning functions. i've explored couple tutorials, can't yet visualize how immediate problem can translated function. in addition, got error message when put sample function inside while loop; not being able redeclare it.

so wondered if show me how convert following function. note code, including table cell, inside while loop. have somehow remove while loop before put function in it?

switch($latin) {  case 'aix sponsa':  case 'gavia immer':  $star_rating = '<sup><span style="color: #f00;"><b>+</b></span></sup>';  break;  default:  break; }  <td class="symbol"><a href="$gz_url/life/'.$latinl.'" title="'.$symbol.'  ('.$latin.')">'.$row['symbol'].'</a>'.$star_rating.''.$desigast.'</td> 

define function outside loop:

function get_star_rating($latin) {     $star_rating = '';     switch ($latin) {         ...     }     return $star_rating; } 

inside loop, do:

echo <td class="symbol"><a href="$gz_url/life/'.$latinl.'" title="'.$symbol.'  ('.$latin.')">'.$row['symbol'].'</a>'.get_star_rating($latin).$desigast.'</td> 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -