PDA

Click to See Complete Forum and Search --> : How to bold the search term word in search ouput


tony007
May 23rd, 2006, 10:29 AM
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




$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>

john tindell
May 23rd, 2006, 11:50 AM
use str_replace() (http://uk2.php.net/str_replace) to replace the search time in the song name with the added <b></b> tags around it