Hi,
The following code takes a 'term' and replaces it with the data from the database within an HTML file.
// Format the results to specified
// standards
while($search_array = mysql_fetch_array($this->results)) {
// First term
$this->formatted_results = str_replace("ID", $search_array['id'], $html);
// Second term
$this->formatted_results = str_replace("NAME", $search_array['name'], $html);
// Third term
$this->formatted_results = str_replace("DESCRIPTION", $search_array['description'], $html);
}
Not everything is there obviously but I'm looking to see if there is a quicker way to perform that str_replace method?
I know I could use an array for the search terms within that str_replace function, but I can't think of a way to use an array or something similar for the replacement terms?
Any ideas would be appreciated.. have quite a few terms to add, and if I only had to update an array, that'd be better. 😃
Thanks,
Chris