ok what i am trying to do is have the user insert cretin things like %address%, and what will happen is i would have data be recalled from the DB and replaced with what it needs to be
1234 main st

this is what i have idk if it is a step in the right direction or now.

$result = mysql_query("SELECT * FROM table WHERE id='1' ");
        while($myrow = mysql_fetch_assoc($result))

//includes the data of the user input
$content = $myrow['content'];
	 $result = mysql_query("SELECT * FROM table WHERE idr='$id' ");
        while($myrow = mysql_fetch_assoc($result))
$address = $myrow['address'];

				 $searchArray = array("%address%", "%state%", "%city%");
				 $replaceArray = array($address, "state", "city");
				 $content = str_replace($searchArray, $replaceArray, $content);

Well the only comment I have is that you could do a better database design if I'm reading that code correctly. Also, what is your database design as in what columns are in what table(s)? Although I would design it with only one loop, as pointed out in your code, str_replace is the way to go.