kaancho12
Technical User
- Feb 22, 2005
- 191
hi,
this is a follow up from my earlier post about str_replace.
When i do a regular str_replace using the following it works fine:
$search = "<A HREF=\"/ABC/specs/10to99/pdf/abc16.pdf\">16</A>";
$replace = "<A HREF=\"/ABC/specs/10to99/pdf/abc16.pdf\">16TTTT</A>";
str_replace($search, $replace, $contents);
But when the $search, $replace are obtained through a mysql query then they dont seem to work.
while ($fetch = mysql_fetch_array($sql)){
$search = '"' . $fetch["preg"] . '"';
$replace = '"' . $fetch["preg"] . $fetch["pregReplace"] . '"';
$new_str = str_replace($search, $replace, $contents);
}
here, $fetch["preg"] and $fetch["pregReplace"] are results of a mysql query. This doesnt seem to work ??????
any idea why?????
thanks in advance
ko12
this is a follow up from my earlier post about str_replace.
When i do a regular str_replace using the following it works fine:
$search = "<A HREF=\"/ABC/specs/10to99/pdf/abc16.pdf\">16</A>";
$replace = "<A HREF=\"/ABC/specs/10to99/pdf/abc16.pdf\">16TTTT</A>";
str_replace($search, $replace, $contents);
But when the $search, $replace are obtained through a mysql query then they dont seem to work.
while ($fetch = mysql_fetch_array($sql)){
$search = '"' . $fetch["preg"] . '"';
$replace = '"' . $fetch["preg"] . $fetch["pregReplace"] . '"';
$new_str = str_replace($search, $replace, $contents);
}
here, $fetch["preg"] and $fetch["pregReplace"] are results of a mysql query. This doesnt seem to work ??????
any idea why?????
thanks in advance
ko12