I think it works there is now a border around the empty data field but it doesn't seem to like being in a loop function. I'm getting an Error message saying: Cannot redeclare padcell() (previously declared in C:\wamp\www\processforms.php:line68)
Instead of running the loop five times it terminates after printing the first loop.
$englishinput=mysql_real_escape_string(@$_POST['englishinput']);
$query="SELECT word, COUNT(word) AS word_count FROM dictionary WHERE english='$englishinput'
GROUP BY word ORDER BY word_count DESC LIMIT 5";
$result=mysql_query($query) or exit(mysql_error());
while ($row=mysql_fetch_assoc($result))
{
function padCell($text)
{
if(trim($text) === '')
{
$text = ' ';
}
return $text;
}
printf(
'<tr><td align="center">%s</td><td align="center">%s</td><td valign="middle">%s</td></tr>',
padCell($row['word_count']),
padCell($row['word']),
padCell($commentinput)
);
}
echo '</table>';