Ok i am doing some work for my local football team, and i have a db table with players names and another with fixture details.
Now in the fixture details i have a field for match report which is a long text
What i am trying to do is create a function which replaces all the instances of each player name found in the report with the players name but hyper linked to his profile page.
so for example if my name was in the report the function would produce the following
Luke Jackson => <a href='staff_profile.php?id=10929'>Luke Jackson</a>
So i tried this
//GET LIST OF NAMES TO SEARCH FOR
$sql = mysql_query("SELECT staffID, staffName FROM tbl_staff");
$id = $row['staffID'];
$name = $row['staffName'];
$addLink = str_replace($name, "<a href='staff_profile.php?id=$id'>$name</a>", $report);
and tried echoing the match report out like so
<?php echo FindNames($report)?>
but it doesnt replace any of the names found in the report, nothing changes
any ideas what i doing wrong?