I want to create a function that will search through a text, find names those match with existing names in the database and add links to those names before submitting the article to the database.
i.e. text: Chelsea are making a change now as goalscorer Nicolas Anelka is replaced by in-form Florent Malouda who can do no wrong lately.
Nicolas Anelka exists in the database in the Players table with ID column equals to 1.
I want text to be converted to Chelsea are making a change now as goalscorer a href="player.asp=ID=1"Nicolas Anelka/a is replaced by in-form Florent Malouda who can do no wrong lately.
Problem with my code is that I have player names are stored in one column. So Nicolas Anelka is one column so names dont match with letters.
Function PlayerStats (ArticleDesc)
If IsNull(ArticleDesc) Then Exit Function
WordArray = Split(ArticleDesc, " ")
For i = 1 to Ubound(WordArray)
SQL = "SELECT PlayerID, PlayerName"
SQL = SQL & " FROM Players"
Set objPlayer = objConn.Execute(SQL)
Do While NOT objPlayer.EOF
If WordArray(i) = objPlayer("PlayerName") Then
PlayerStats = objPlayer("PlayerName") & " is in the database!"
Else
End If
objPlayer.MoveNext
Loop
Next
End Function