Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7922197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:52:21+00:00 2026-06-03T16:52:21+00:00

Quick question here, i’ve got a process running that grabs RSS feeds and adds

  • 0

Quick question here, i’ve got a process running that grabs RSS feeds and adds them to a mySQL database.

During this process I’ll be using the Readability API to grab the URL content as I go.

Now this works fine on single entries, but as this script can have hundreds of entries, nothing is being inserting into my database.

I’m wondering if it’s not getting a chance to finish the process and immediately skipping onto the next entry in the RSS.

Can anyone suggest a way of letting it finish before moving on? Code below:

$db_hostname="localhost";
$db_username="myusername";
$db_password="mypassword";

try
{
/*  query the database */

$db = mysql_connect($db_hostname,$db_username,$db_password);
if (!$db)
{
    die("Could not connect: " . mysql_error());
}
mysql_select_db("MyDB", $db);


// Get stories that don't have a the readability assigned
$query="select item_id, item_url from tw_articles_parse where story_readability = '' LIMIT 0 , 1";
$result=mysql_query($query);
$num=mysql_numrows($result);
// Close the DB connection
mysql_close();


// Start the loop of source RSS feeds
$i=0;
while ($i < $num) {

    $item_url=mysql_result($result,$i,"item_url");
    $item_id=mysql_result($result,$i,"item_id");

    // Parse the story URL into the Readability API
        $url = "https://www.readability.com/api/content/v1/parser?url=$item_url&token=myapikey";
        // Get the contents of the JSON returned by the API
        $json = file_get_contents($url);
        // Decode the JSON
        $out = json_decode($json, true);
        // Set the content as a variable
        $story = mysql_real_escape_string($out['content']);

        // Insert into the DB - Adding 0 to story_club_id as default
        $item_insert_sql = "UPDATE tw_articles_parse SET story_readability=$story WHERE item_id='" . $item_id . "'";
        $insert_item = mysql_query($item_insert_sql, $db);



$i++;
}// end the loop of feeds


   } catch (Exception $e)
{
echo 'Caught exception: ',  $e->getMessage(), "\n";
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:52:24+00:00Added an answer on June 3, 2026 at 4:52 pm

    Probably nothing is inserted because you are using UPDATE statement and there are simply no such records with correspoding item_id to be updated?
    Try changing UPDATE query to INSERT … ON DUPLICATE KEY UPDATE

    Unfortunately we don’t know your database scheme, but something like this should work:

    $item_insert_sql = "INSERT INTO tw_articles_parse (story_readability, item_id) VALUES ('$story', $item_id) ON DUPLICATE KEY UPDATE story_readability='$story'";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a quick question here. I know that the cakePHP find('first') function returns
Hey guys got a quick question here, how do i set up TweetStream after
Just a quick newbie question here. I have a method that calculates a value
Quick question/clarification required here. I have a DB table that will quite possibly have
This is just a quick Question. I am writing a feature here that creates
Hi just a quick question here I got an account on www.assembla.com which is
Here's a quick question that's probably simpler than I'm thinking. I'm populating a jQuery
Just a quick question here. I have a program in which I need to
Possible Duplicate: How to append data to a file? Quick question here, how can
Quick question hopefully someone can help out here. I'm trying to copy and paste

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.