[SOLVED]Select, Match and Pull from same row?
Posted: Fri Oct 28, 2005 5:08 am
What I'm trying to do is convert my hard-coded preg_replace stuff
to be web-adminable, which means have the data stored in mySQL DB and
then using variables on php to pull.
The way i set it up for now is
Table= filter
Fields= word, replace
and the php would be
The problem with that is it will only replace the first word found.
How do I change it so it will replace anyword that matches whats in the DB?
to be web-adminable, which means have the data stored in mySQL DB and
then using variables on php to pull.
The way i set it up for now is
Table= filter
Fields= word, replace
and the php would be
Code: Select all
$getWord = mysql_query("SELECT * FROM filter ");
$checkWord = mysql_fetch_array($getWord);
$Word = $checkWord['word'];
$Replace = $checkWord['replace'];
if ($Word == $Word) {
$html = preg_replace("#$Word#i", "$Replace", $html);
}else{
}How do I change it so it will replace anyword that matches whats in the DB?