When i odbc_connect() to MS SQL with PHP using ODBC in local network(not host), the connection takes about 11 seconds. Here is the code of my connection:
function __construct(){
$connstr = "Driver={SQL Server};Server=serv;Database=Base;";
$this->lnk = odbc_connect($connstr, "login", "passs");
}
And when i odbc_fetch_row() it also takes about 5 seconds. Here is my result function code:
function manual($query){
$result = odbc_exec($this->lnk, $query);// or exit(odbc_error);
for($i = 1; $i<odbc_num_fields($result)+1; $i++){
$arr_row[] = odbc_field_name($result,$i);
}
while(odbc_fetch_row($result)){
foreach($arr_row as $name){
$ownsql_result[$name][] = trim(odbc_result($result, $name));
}
}
odbc_free_result($result);
return $ownsql_result;
}
Im Using WAMP on Windows 7 and MS SQL 2000 on other PC Windows Server 2003 in same local network… Plz guys help out
The problem was in MSSQL SERVER VERSION… i changed it from 2000 to 2005 and all worked fiine