I have a .php file that reads an .rtf file on my server and uses str_replace() to replace certain variables within the document. I can do that fine, but I am having trouble writing more than one element to a single variable...i.e. I am pulling several products from a mysql database, and then I want to group them and output the entire contents with a line break after each element to one of the variables in the rtf document to display the products neatly in a list...any suggestions?

Use something like this: (or modify to use an array)

$items = mysql_query("SELECT name FROM items");

while ($item = mysql_fetch_array($items))
{
$output .= $item . "
";
}

print $output;

Tada :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.