Personally I would keep the HTML section for printing out values only, not doing database connections, calling functions, and so on. Something like this:
<?php
$rows = array();
while ($row= mysql_fetch_array($result, MYSQL_ASSOC))
{
$row['cquote_hi'] = highlightWords(htmlspecialchars($row['cQuotes']), $search_result);
$rows[] = $row;
}
?>
<table class="result">
<?php foreach ( $rows as $row ) : ?>
<tr>
<td style="text-align:right; font-size:15px;"><?php h($row['cArabic']); ?></td>
<td style="font-size:16px;"><?php echo $row['cquote_hi']; ?></td>
<td style="font-size:12px;"><?php h($row['vAuthor']); ?></td>
<td style="font-size:12px; font-style:italic; text-align:right;"><?php h($row['vReference']); ?></td>
</tr>
<?php endforeach; ?>
</table>
If your server setup allows it, you can echo variables with short tags: <?=$row['cquote_hi']?>
I don't know what the h() function is doing but you could perhaps call it for each variable in the original while loop, then just echo the variables.
DisgruntledGoat
2010-05-28 16:12:06