How to insert into table in database after every 5 minutes using Real time clock module I have RTC module attached to arduino mega, 

to calculate time difference of minutes I am getting minute from the RTC module

and checking if passed time is greater than 5 minutes  then insert to MySQL table in database.

  int mint = util::getMinute();

  if (util::getMinute() - mint &gt;= 5)

  {
    // inserting to sql database on mysql server
    INSERT_SQL = "";
    INSERT_SQL.concat("INSERT INTO arduinoSensorData.outTempLog (out_temperature) VALUES ('");
    INSERT_SQL.concat(tempInC);
    INSERT_SQL.concat("');");

    const char *mycharp = INSERT_SQL.c_str();
    delay(1000);

    if (!connected) {
      my_conn.mysql_connect(server_addr, 3306, user, password);
      connected = true;
    }
    else if (connected == true)
    {
      delay(500);
      Serial.print("Inserting : ");
      Serial.println(INSERT_SQL);
      Serial.println("Connection Successfull,inserting to database.");
      my_conn.cmd_query(mycharp);

    }
    else {
      Serial.println("Connection failed.");
    }
    mint = util::getMinute();
  }


the full code is here
int mint = util::getMinute();

if (util::getMinute() - mint &gt;= 5)

{


Well, if mint is util::getMinute() then surely util::getMinute() - mint will always be 0.

I think you meant mint to be static, or a variable in the global scope.