私のクエリは次のとおりです。
$query = $mysqli->query("SELECT col3 FROM table WHERE col3!='' AND col1= 'bond'");
ここで、col2 が空白ではない col1 からすべてを取得し、<a href="#">col1</a>
col1 値が col3 値に存在する場合のように、col3 値をすべての col1 値に置き換える必要があります。
例: Col3 値:
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.
col1 にある binds、bonda、または sense が見つかり、col2 が空でない場合、bind、bonda、または sense を b> tag Like に置き換え<b>binds</b>, <b>bonda</b> or <b>sense</b>
ます。
結果を次のように置き換えた後:
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.
私は試しました:
$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']);