one func is sometimes work sometimes not but always print but don't enter data to dada base. function findintext($namesearch) { $address='http://www.mysite.com/wp-content/themes/mytheme/k/k'; for ($i=1; $i < 36; $i+=1) { $lines = file($address.$i.'.htm'); foreach ($lines as $line_num => $line) { //echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n"; if (0<>strrpos($line,"H1")) {$linestart = strip_tags($line);} if (0<>strrpos($line,' '.$namesearch)) { $linetoinsert= $linestart.strip_tags($line); echo "<br>".$linetoinsert; add_post_meta($post->ID,'tora'.$i, $linetoinsert,false); } } } } PHP: another func is working only then it isn't in the func status but stand alone. please send me a pm. thanks.
function findintext($namesearch) { global $post; $address='http://www.mysite.com/wp-content/themes/mytheme/k/k'; for ($i=1; $i < 36; $i+=1) { $lines = file($address.$i.'.htm'); foreach ($lines as $line_num => $line) { //echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n"; if (0<>strrpos($line,"H1")) {$linestart = strip_tags($line);} if (0<>strrpos($line,' '.$namesearch)) { $linetoinsert= $linestart.strip_tags($line); echo "<br>".$linetoinsert; add_post_meta($post->ID,'tora'.$i, $linetoinsert,false); } } } } PHP: global $post is needed.