Okay Now I'm editing old problem because its done but now i've new problem I've knowledge of mysql queries but not wordpress queries I'm doing this with mysql queries and its working well but server is going damn slow i know i'm running about 30 query per page load so is there any way to do it easily with help of wordpress queries or something else ???
<?php $rss = fetch_feed('http://example.com/feed');
if (!is_wp_error( $rss ) ) :
$maxitems = $rss->get_item_quantity(10);
$rss_items = $rss->get_items(0, $maxitems);
endif;
if ($maxitems == 0) ;
else
foreach ( $rss_items as $item ) :
$posttitle=$item->get_title();
$postcontent=$item->get_description();
$pt=mysql_real_escape_string($posttitle);
$pc=mysql_real_escape_string($postcontent);
$result=mysql_query("SELECT post_title FROM wp_posts WHERE post_title='".$pt."'");
if(mysql_num_rows>0)
{
echo "hello";
mysql_query("UPDATE wp_posts SET post_title='".$pt."',post_content='".$pc."' WHERE post_title='".$pt."'");
}
else
{
echo "hi";
mysql_query("INSERT INTO wp_posts (post_title,post_content) VALUES ('".$pt."','".$pc."')");
}
endforeach; ?>