help required

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
younis
Forum Newbie
Posts: 2
Joined: Fri Sep 05, 2008 2:15 am

help required

Post 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
Post Reply