main function that run every 3 sec and update value in db
function 1

```
public function set_cron_value() {
    for($i=1; $i < 20; $i++) {
        $this->db->query('UPDATE users SET pass_change_flag = (pass_change_flag + 1) WHERE u_id = 123');
        sleep(3);
    }
}

```

this function return the db data
function 2

```
public function get_cron_value() {
    echo $this->db->query('SELECT * FROM users WHERE u_id = 123')->row()->pass_change_flag;    
}

```

when function 1 is running function 2 halt and did't return any thing until function 1 execution completed is there any solution that function 1 execution did not effect other functions execution

i am using php frame work codeigniter

thanks