0

I had tried to specified the seconds in set_time_limit(3);

 times set_time_limit(3);
 function runQuery($sql) {
 global $coni;
 try {
    $execution_time=0;
    $time_start = microtime ( true );
    $result=db2_exec ( $coni, $sql );
    $time_end = microtime ( true );
    $execution_time = ($time_end - $time_start) / 60;
    return $result;

} catch ( Exception $e ) {
    echo "exec error: " . db2_stmt_error ( $sql ) . "<br />";
    echo "exec errormsg: " . db2_stmt_errormsg ( $sql ) . "<br />";
}
}

but i did not work My problem is that is it possible to set the SQL execution time in php? e.g i expect my query could return result within 3 seconds, if i could not get result within 3 seconds, then i would like to cancel the query.

Rui
  • 1
  • 5
    Possible duplicate of [Set maximum execution time in MYSQL / PHP](https://stackoverflow.com/a/18254099/5447994) – Thamilhan Jul 03 '17 at 04:47
  • Try this link for some guidance. https://stackoverflow.com/questions/27719803/stop-query-through-pdo – Difster Jul 03 '17 at 04:49

0 Answers0