Here is my function:
function grabstuff()
{
foreach (glob("../folder/*.php") as $fn)
{
$file = file_get_contents($fn);
preg_match_all("#\{\('(\w+)'\)}#", $file, $matches);
foreach ($matches[1] as $match)
{
$query = ("ALTER TABLE xxxxx ADD COLUMN `$match` LONGTEXT AFTER xxxxx;");
$result = mysql_query($query) or die("Err: ".mysql_error());
}
}
}
And here is what it looks for on the pages:
<?/*{('test test')}*/?>
It is ignoring this instance where there is a whitespace. It works well for testtest and test_test. Not getting any php errors or mysql errors. Do I need to use \w+\S
or \w+\W
? I tried both of those, even (...) and it still didn't work. How do I get my above function to recognize any characters within the {('')}, whether they be a normal abc characters or whitespace. I'm sure this is simple. I've done research on google and here and wasn't able to find a solution. (There will be multiple instances of {('')} on any given page if that helps). I've been using this function for a while now, but would like to add the ability to include whitespaces. Thanks!
No comments:
Post a Comment