Results 1 to 2 of 2

Thread: How to bold the search term word in search ouput

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    How to bold the search term word in search ouput

    I am using the following query for searching for songname and i want make the entered search term bold not the whole song name. For example if search for song name that starts with love i want the the output look like this :


    power of love

    write now it display the whole song name without bolding the search term .Could any one show me how that can be then.Thanks


    <b><?=strval( $row['songname'] );?></b> ===> display songname




    PHP Code:
    $query  = "select id,artist,album,songname from musictest where songname like '%$s%'";
     
    <td><? echo $numbers; ?>&nbsp;</td>
            <td><a href="javascript:newWindow('./playlistfromdbtotextfile.php?songid=<?=strval$row['id'] );?>')"><img
            src="./images/Speaker.gif" alt="Listen to this Song"
            border="0" width="16" height="16"
            longdesc="Listen to this Song"></a> <b><?=strval$row['songname'] );?></b>&nbsp;</td>
            <td><a
            href=" ./albumsongs.php?albumname=<?=strval$row['album'] );?>&artistname=<?=strval$row['artist'] );?>"><?=strval$row['album'] );?></a>&nbsp;
            </td>
            <td><a
            href="albums.php?albumname=<?=strval$row['artist'] );?>"><?=strval$row['artist'] );?></a> </td>
            
        </tr>

  2. #2
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: How to bold the search term word in search ouput

    use str_replace() to replace the search time in the song name with the added <b></b> tags around it

Posting Permissions

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



Click Here to Expand Forum to Full Width