I am getting PHP timeout errors when calling mysql_query() for a relatively small query, so i have to set the limit to 10.
Fatal error: Maximum execution time of 120 seconds exceeded in C:\xampp\htdocs\data.php on line 19
I have removed the loop from the code, the code seems to hang at the mysql_query() function..
mysql_connect("192.168.50.250",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT T.Tag as 'Device', y.alarmdesc as 'AlarmType', a.Active, a.Cleared FROM gencore.gc_alarms a JOIN ist.Tree T ON(T.DeviceId = a.DeviceId) JOIN GenCore.gc_alarmtypes y ON (a.alarmType = y.aid) LIMIT 10";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?>
<table class="sortable resizable editable tableStyle2">
<tr class="headerStyle">
<th>Device</th>
<th>AlarmType</th>
</tr>
<?php
$i=0;
while ($i < $num)
{
$f1=mysql_result($result,$i,"Device");
$f2=mysql_result($result,$i,"AlarmType");
?>
<tr>
<td><?php echo $f1; ?></td>
<td><?php echo $f2; ?></td>
</tr>
<?php
$i++;
}
?>
</body>
</html>
The query executes very quick from anywhere else, and is only 340 rows, does anyone have any pointers how to retrieve the small table from the DB?
Regards Johan