My Query is:
$query = $mysqli->query("SELECT col3 FROM table WHERE col3!='' AND col1= 'bond'");
Now I need get all from col1 where col2 is not blank and then col3 value replace with all col1 value like <a href="#">col1</a>
if col1 value exist in col3 value.
Example: Col3 Value:
bond early 13c., "anything that binds," phonetic variant of band (1) (for vowel change, see long), influenced by O.E. bonda "householder," lit. "dweller" (see bondage). The verb is 1670s (trans.), 1836 (intr.). Legalistic sense first recorded 1590s.
Suppose binds, bonda or sense found on col1 and col2 is not empty then binds, bonda or sense Replace with b> tag Like <b>binds</b>, <b>bonda</b> or <b>sense</b>
.
After Replace The Result Like:
bond early 13c., "anything that <b>binds</b>," phonetic variant of band (1) (for vowel change, see long), influenced by O.E. <b>bonda</b> "householder," lit. "dweller" (see bondage). The verb is 1670s (trans.), 1836 (intr.). Legalistic <b>sense</b> first recorded 1590s.
I tried with:
$query = $mysqli->query("SELECT col3 FROM table WHERE col3!='' AND col1= 'bond'");
$query2 = $mysqli->query("SELECT col1 FROM table WHERE col2 !='' ORDER BY LENGTH(col1) DESC");
$row = $query->fetch_assoc();
$row2 = $query2->fetch_assoc();
$result = str_replace($row2['col1'], '<b>'.$row2['col1'].'</b>', $row['col3']);