while loop not working for acessing sql records
<p>I am passing a string to this file -txtname- (string separated by spaces) and saparate      each word and then pass it to the function <code>subtoken()</code> that should fetch the corresponding words from the database, having two attributes-rootwords and example,but <code>subtoken()</code> function executes only once and exits.</p>

<pre><code>$counter=0; 

$string = $_REQUEST['txtname'];
$token = strtok($string, ' ');
while ($token != false)
{echo $counter;
  subtoken($token,$counter);

 $counter++;
 $token = strtok(' ');  

}


function subtoken($fname,$counter)
{
$row ="";
$result="";
$result = mysql_query('SELECT * FROM hindi WHERE rootwords LIKE  \'%:'.$fname.':%\'' );

while($row = mysql_fetch_array($result))
{
$temp=$row['rootwords'];
$token2 = strtok($temp, ':');
echo $token2 ;
while($token2!=false)
{

    echo $token2."&lt;br/&gt;" ;
    $token2=strtok(':');
}

}

}

mysql_close($con);
</code></pre>
