0

i have a website with a Mysql database that has html in each row (yes, i know this is not ideal). The problem is that the programmer simply copied and pasted duplicated text in many rows. I therefore have to manually edit the html in many rows if i need to update the text. I wanted to includ a 'include' or 'require' function and store the generic html in an external file but it doesnt seem to parse in the mysql output (only shows the static html). Therefore, how can i include reference to an external file in the header html of the mysql rows that contains html? That is, i need to parse php included in a row of the mysql database and not from a php page calling to the database. I tried to the eval function but still it could not retrieve a external php file.

Another alternative is that the duplicated text is actually another row in the database. Therefore, i'm not sure how i can make a page dynamically pull multiple rows from the database in a specific order?

What a mess. Any ideas?

Cheers

4

1 回答 1

0

您可以在获取它们时解析每一行。

preg_match_all ("#include\((.+)\)#", $row, $result);
foreach ($result[1] as $value) {
    include ($value);
}

或类似的东西。:)

http://php.net/manual/fr/function.preg-match-all.php

于 2012-07-30T00:52:27.573 回答