Jump to content

strpos from a mysql database


a1amattyj

Recommended Posts

Hello again!

 

I have a mysql database with multiple records of which each contains a php code to be replaced. Therefore, i run a database query to store this contained code in a variable. For example, one of my variables would contain:

 

function replace_me()

{

// All of this function should be replaced.

}

 

However, for some reason it will not replace it. I've tried printing the code from the variable and it does show the function.

 

 

If i simply scrap the database query and store

 

function replace_me()

{

// All of this function should be replaced.

}

 

in another variable, it will work. I assume its the database parsing the data over?

 

 

 

$find1 = $db->query("SELECT * FROM `parse` WHERE `id` = '1'");

if($db->num_rows($find1) != 1)
{
exit;
}
$find2 = $db->fetch_array($find1);
$find = $find2['searchFor'];


$pos = strpos($contents, $find);

if ($pos === false) 
{
$page->output_fail("Could Not Parse String", "Theme could not be parsed because the string could not be found. 
<br />
It may already have been parsed. Manually Parse?");
$page->output_manual_parse($find,  $replace, $contents, $dest);
}

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/150369-strpos-from-a-mysql-database/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.