Modify echo output
<p>I am fetching some data from MySQL which I print into a table.  I have a function to "X out" the content after the first 2 up to the last 2 digits of a number.</p>

<p>Now I am trying to use that function on every number in the row 'code' where the MySQL result is <code>used=''</code> before printing it.</p>

<p>Example:  Data from mysql row 'code' and 'used':</p>

<blockquote>
  <p>code = 123456789  &amp; used = 'n' result=123456789<br>
  code = 123456789  &amp; used = '' result=12XXXXX89</p>
</blockquote>

<p>This is my code for fetching, creating the table and also for the function to "X out" the middle digits:</p>

<pre><code>&lt;?php
$sql="SELECT * FROM table";
$result=mysql_query($sql);

// Count table rows
$count=mysql_num_rows($result);

?&gt;

&lt;?php function blankit($word) {
    return substr($word, 0,2). str_repeat("X",strlen($word)-4) . substr($word, strlen($word)-2,strlen($word));
} 
?&gt;

&lt;?php while($rows=mysql_fetch_array($result, MYSQL_ASSOC)){ ?&gt;
&lt;tr class="first"&gt;
&lt;td class="tc"&gt;&lt;font face="Arial, Helvetica, sans-serif"&gt;&lt;? echo $rows['id']; ?&gt;&lt;/font&gt;&lt;/td&gt;
&lt;td class="tc"&gt;&lt;font face="Arial, Helvetica, sans-serif"&gt;&lt;? echo $rows['code']; ?&gt;&lt;/font&gt;&lt;/td&gt;

&lt;td&gt;&lt;font face="Arial, Helvetica, sans-serif"&gt;&lt;? echo $rows['date']; ?&gt;&lt;/font&gt;&lt;/td&gt;
&lt;td class="tc"&gt;&lt;font face="Arial, Helvetica, sans-serif"&gt;&lt;? echo $rows['ip']; ?&gt;&lt;/font&gt;&lt;/td&gt;
&lt;td class="tc"&gt;&lt;input name="checkbox[]" type="checkbox" class="checkbox" id="checkbox[]" value="&lt;? echo $rows['id']; ?&gt;"&gt;&lt;/td&gt; 


&lt;/tr&gt;
&lt;?php
}
?&gt;
</code></pre>
