Hi all,
Could someone please shed light on my problem?
I have records in a mysql database and i want to echo them out but hyperlink to certain words it finds in a field.
MY CODE
$aboats=array("Artemis","Alaric","Ambush","Acheron","Trumph");
$splitdata = explode(',',$boats);
foreach ($splitdata as $key => $sub) {
if (in_array("$sub",$aboats)) {
echo"<span class=black><a href=../boats/$sub> $sub </a></span>";
}
else{
echo"$sub";
}
}
the $boat var is taken from the database and as a varchar in text. (i.e: Artemis,Acheron,Trafalgar etc....)
The above code works but only hyperlinks the first match it finds..........
Any help please?