Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2004
    Posts
    54
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Link within an explode/implode

    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 Code:
    <?php
    function isnotempty ($var) {
    return (
    strlen (trim ($var)) > 0);
    }
    $tmp explode ("\r\n"$row['keywords']);
    echo (
    "<p>" implode (', 'array_filter ($tmp"isnotempty")) . "</p>");
    ?>

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Well what link would you want them to go to? What is the format?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New Coder
    Join Date
    Sep 2004
    Posts
    54
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    Well what link would you want them to go to? What is the format?
    The link is

    Code:
    <a href="search.php?q=keyword">keyword</a>

  • #4
    New Coder
    Join Date
    Sep 2004
    Posts
    54
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Apparently I've stumped ya'll.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •