简体   繁体   中英

mysql_query SELECT statement in php stops returning results after a while?

I have made a program that continuously processes tweets and categorizes them into different archives.

For that I have a php script that continuously loops (WHILE TRUE) and checks if new tweets have arrived in the database. It therefore also selects all possible archives a tweet can belong to:

mysql_query("SELECT id from archives", $db->connection);

Where $db->connection is

class MySQLDB
{
 var $connection;      

 function MySQLDB(){
      $this->connection = mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error());
      mysql_select_db(DB_NAME, $this->connection) or die(mysql_error());
   }

}
$db = new MySQLDB;

This is were the problem lies. This fetching of archives works well but after some time (two to three days) it stops returning results. the mysql select statement does not return any results but does not give an error. Is this a problem someone of you already encountered? Can anyone give hints on what could be the issue here?

Thanks a lot!

do you check what does mysql_query return?

maybe instead of an empty result set it returns 'false' for error?

try

mysql_query() or die('error:'. mysql_error());

http://www.php.net/manual/en/function.mysql-error.php

my guess is that after running for so long, the ammount of records to fetch from the database is too big. Do you remove the records you already read?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM