highlighting substrings entered in respective columns
How to highlight '12' in id , '3' in code and 'a' in name in $line.
Highlighting data in respective columns is posing problem. I am able to
highlight only one column at a time. The code below is to highlight a
string in all the columns. I am using span around the substring which is
to be highlighted.
while ($line = mysqli_fetch_assoc($result2)) {
$string=$postdata['mycolval'][0];
$line = preg_replace("|^($string)|Ui", "<span
class='highlights'>$1</span>", $line);
}
$postdata['mycol'] stores names of columns and $postdata['mycolval']
stores values entered in respective columns.The second snap shows
structure of $postdata and the relation between $postdata['mycol'] and
$postdata['mycolval'].
No comments:
Post a Comment