I've got data in a database with things like this:
This is some text[/]
I'd like to replace and with the appropriate html tag before the text is displayed. I've got a table with the the code to find and replacement codes in it and I've been trying to do it like this:
$main_text = is already set in an earlier select and is a text string with etc. in it.
.... select the find and replace codes....
for ($j=0; $j < $numIB; $j++){
$row = $db_fetch_array($resI😎;
$findcode = $row[findcode];
$replacecode = $row[replacecode];
$main_text = strstr($main, $findcode, $replacecode);
}
I thought this would loop through $main_text and replace the findcode with the replacecode (proper html).
But I get the message:
Warning: Wrong parameter count for strstr()
Am I approaching this in the wrong way? I want to allow users to enter simple tags and then replace these with the correct html tags before presenting the page.
TIA, Tony