shanparker
03-11-2008, 07:00 PM
I have the code below pulling data from ONE field in a database that has keywords in it, separated by line breaks. Sort of silly, now I know, had I known when I built the database, what I do now I might have went about it differently. But it now, is what it is.
In any case, what I'm needing to do is link each keyword. Right now the code below divides each keyword with a comma. But I'm now also wanting to link each keyword back to the search engine, so people can search those words just by clicking on them.
I've tinkered with this code for several hours, to no avail.
Help?
<?php
function isnotempty ($var) {
return (strlen (trim ($var)) > 0);
}
$tmp = explode ("\r\n", $row['keywords']);
echo ("<p>" . implode (', ', array_filter ($tmp, "isnotempty")) . "</p>");
?>
In any case, what I'm needing to do is link each keyword. Right now the code below divides each keyword with a comma. But I'm now also wanting to link each keyword back to the search engine, so people can search those words just by clicking on them.
I've tinkered with this code for several hours, to no avail.
Help?
<?php
function isnotempty ($var) {
return (strlen (trim ($var)) > 0);
}
$tmp = explode ("\r\n", $row['keywords']);
echo ("<p>" . implode (', ', array_filter ($tmp, "isnotempty")) . "</p>");
?>