MySQL Forums
Forum List  »  German

Highlighting
Posted by: Rüdiger Sack
Date: May 05, 2018 10:31AM

Ich habe eine Tabelle mit value1 = 'Computerkünstler'.
Ein select * from table where value1 like '%kunst%' liefert mir tatsächlich die Zeile mit dem 'Computerkünstler'. Ist ja erst mal was gutes ;-)

Gibt es eine Möglichkeit die gefundene Stelle gleich gehighlighted zurückzuliefern? Also sowas wie

select replace(value1, '%kunst%', '<span class="highlight">$1</span>') from table where value1 like '%kunst%';

Ihr wisst schon was ich meine. Wenn ich das anschließend mit PHP machen will, finde ich natürlich Computerkünstler nicht: PHP: str_replace('kunst', '<span...>kunst</span>', 'Computerkünstler') geht natürlich schief...

Danke und Gruß

Options: ReplyQuote


Subject
Views
Written By
Posted
Highlighting
569
May 05, 2018 10:31AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.