I have a problem with my query taking too long to execute thus timing out. Does anyone know how I cand set the commandtimeout?
Here's my code it works on small tables but not large ones
<head>
</head>
<body>
<style type="text/css">
.smaller {color:rgb(0,0,0);
font - size:9pt}
</style>
<?
$Sp = " ";
{echo "<table id = 'C1' class='smaller' width = 750 border=1 cellpadding=1 cellspacing=1>";}
{echo "<caption ><font size = 4><b>Query List</b></font></caption>";}
{echo "<tr><th>Name</th><th>Employee ID</th><th>Employer</th></tr>";}
$connection = odbc_connect("SERVER","TESTDB","PASSWORD") or die ("no connection");
$sql = "SELECT TESTDB.TABLE1.PNAME AS name, TESTDB.TABLE1.EMPIDNO AS empidno, ";
$sql .= "TESTDB.TABLE2.NAME AS employer FROM TESTDB.TABLE1 INNER JOIN ";
$sql .= "TESTDB.TABLE2 ON TESTDB.TABLE1.EMPIDNO = TESTDB.TABLE2.EMPIDNO ";
$sql .= "WHERE TESTDB.TABLE1.STATE = 'PA'";
$result = odbc_prepare($connection, $sql);
odbc_setoption($result,2,0,600);
odbc_execute($result);
$num_cols = odbc_num_fields($result);
while ($row = odbc_fetch_row($result)) {
$name = odbc_result($result, 1);
$empidno = odbc_result($result, 2);
$employer = odbc_result($result, 3);
{echo "<tr><td>$Sp $name</td><td>$Sp $empidno</td><td>$Sp $employer</td></tr>";}
}
?>
</table>
</body>
All help will be greatly appreciated
Here's my code it works on small tables but not large ones
<head>
</head>
<body>
<style type="text/css">
.smaller {color:rgb(0,0,0);
font - size:9pt}
</style>
<?
$Sp = " ";
{echo "<table id = 'C1' class='smaller' width = 750 border=1 cellpadding=1 cellspacing=1>";}
{echo "<caption ><font size = 4><b>Query List</b></font></caption>";}
{echo "<tr><th>Name</th><th>Employee ID</th><th>Employer</th></tr>";}
$connection = odbc_connect("SERVER","TESTDB","PASSWORD") or die ("no connection");
$sql = "SELECT TESTDB.TABLE1.PNAME AS name, TESTDB.TABLE1.EMPIDNO AS empidno, ";
$sql .= "TESTDB.TABLE2.NAME AS employer FROM TESTDB.TABLE1 INNER JOIN ";
$sql .= "TESTDB.TABLE2 ON TESTDB.TABLE1.EMPIDNO = TESTDB.TABLE2.EMPIDNO ";
$sql .= "WHERE TESTDB.TABLE1.STATE = 'PA'";
$result = odbc_prepare($connection, $sql);
odbc_setoption($result,2,0,600);
odbc_execute($result);
$num_cols = odbc_num_fields($result);
while ($row = odbc_fetch_row($result)) {
$name = odbc_result($result, 1);
$empidno = odbc_result($result, 2);
$employer = odbc_result($result, 3);
{echo "<tr><td>$Sp $name</td><td>$Sp $empidno</td><td>$Sp $employer</td></tr>";}
}
?>
</table>
</body>
All help will be greatly appreciated