Is there some way I can change the value of the string I replaced so that it replaces it with another value.
I'm only saying it cause I want to change {name}(from an html page, sort of like a template page) with the name of each tournament from the database.
Here's the code I'm using.
Code: Select all
$query = "SELECT * FROM tournaments ORDER BY id DESC";
$tourneys = $DB->Query($query);
while ($row = mysql_fetch_row($tourneys)) {
if ($row) {
$this->tournamentї'id'] = $rowї0];
$this->tournamentї'name'] = $rowї1];
$this->tournamentї'game'] = $rowї2];
$this->tournamentї'standings'] = $rowї3];
$this->tournamentї'winners'] = $rowї4];
foreach ($this->tournament as $key => $value) {
$this->html = preg_replace("/{".$key."}/", $value, $this->html);
}
echo $this->html;The html page($this->html) has the following code.
Code: Select all
<a href="tournament.php?id={id}">{name}</a>What should I do? how can I make preg_replace erase it's first value, and add another one the next loop.