I created this code to get an Interbase database, the total sales of a particular day:
<?php
ini_set('memory_limit', '128M');
include("sql.php");
//Recibo los datos
$dia='21';
if( isset( $_POST['dia'] ) )
{
$dia=$_POST["dia"];
}
$mes='07';
if( isset( $_POST['mes'] ) )
{
$mes=$_POST["mes"];
}
$an='2014';
if( isset( $_POST['ano'] ) )
{
$an=$_POST["ano"];
}
conectar();
//consulta las Ventas del Corte Actual
$sql="SELECT SUM(CASE WHEN VENTAS.tipo_documento = 'FAC' THEN 1 ELSE 0 END) as Facturas, SUM(CASE WHEN VENTAS.tipo_documento = 'DEV' THEN 1 ELSE 0 END) as Devoluciones, SUM(CASE WHEN VENTAS.tipo_documento = 'FAC' THEN ventas.total_lineas ELSE 0 END) - SUM(CASE WHEN VENTAS.tipo_documento = 'DEV' THEN ventas.total_lineas ELSE 0 END) as Facturado FROM VENTAS WHERE (EXTRACT(DAY FROM VENTAS.fecha_emision) = $dia) AND (EXTRACT(MONTH FROM VENTAS.fecha_emision) = $mes) AND (EXTRACT(YEAR FROM VENTAS.fecha_emision) = $an) AND ventas.temporal = 'F'";
//echo $sql;
$p_sql = ibase_prepare($sql);
$result = ibase_execute($p_sql) or die(ibase_errmsg());
if ($result){
$row = ibase_fetch_assoc($result);
echo $row['FACTURADO'];
}
?>
But i got the error: Fatal error: Maximum execution time of 30 seconds exceeded in line 28... Line 28: $row = ibase_fetch_assoc($result); Then, I added this line:
set_time_limit(60);
and I get the same error, I want the script I have such a long life, in what way I can solve this?
You can try with larger value or
you can enable it in php.ini
http://php.net/manual/en/info.configuration.php#ini.max-execution-time