Page 1 of 1

help required

Posted: Fri Sep 05, 2008 2:32 am
by younis
Hello all!

I am just trying to make a find and replace utility for any database with this facility that if any user find a character or string in database it shows all the list and it gives you option to change it on clicking that specific word or character...... i am using str_replace() function for this
$str = str_replace($find, "<span style='color:#FF0000' id='editme".++$a."'>$find</span>", $str);

i have used a globle variable a for increment so that id of the span is every time different for next occurance of that character or word in the string. But its not working in the way i want as it just assign same id to that character on every occurance or replacement
as if am searching e in "Genevian Seal, luminescent hands, Display Back, power reserve display, subsidiary seconds, luminescent markers"

every e in the string has same id span whereas i want different id for every e in the string

plz help me out