Script php from console linux error mysql

0

I have a script in PHP that I run from the linux console, this script goes through a database table and updates one by one the records in another table, the problem is that randomly, the mysql starts to throwing error in the queries when they are really good, and when this happens all the queries that follow give error.

$mysql=new CMySLQ();
$sql=$mysql->Consultar("SELECT * FROM persona WHERE fecha_baja is NULL ORDER BY codigo ASC");
while($p=mysql_fetch_object($sql)){
  $sql2=$mysql->Consultar("UPDATE persona_existentes SET sigue_ok=Now() WHERE persona=".$p->codigo);
  if(mysql_affected_rows( $mysql->ObtenerManejador()) != 1 ) {
     echo 'fallo al actualizar la persona '.$p->codigo; die;
  } 
}
MariaDB [(none)]> show variables like '%timeout%';
+-------------------------------------+----------+
| Variable_name                       | Value    |
+-------------------------------------+----------+
| connect_timeout                     | 10       |
| deadlock_timeout_long               | 50000000 |
| deadlock_timeout_short              | 10000    |
| delayed_insert_timeout              | 300      |
| innodb_flush_log_at_timeout         | 1        |
| innodb_lock_wait_timeout            | 50       |
| innodb_print_lock_wait_timeout_info | OFF      |
| innodb_rollback_on_timeout          | OFF      |
| interactive_timeout                 | 28800    |
| lock_wait_timeout                   | 31536000 |
| net_read_timeout                    | 30       |
| net_write_timeout                   | 60       |
| slave_net_timeout                   | 3600     |
| thread_pool_idle_timeout            | 60       |
| wait_timeout                        | 28800    |
+-------------------------------------+----------+
15 rows in set (0.00 sec)
    
asked by Fernando 24.10.2018 в 23:33
source

0 answers