I'm getting an error saying Undefined index when using alias on SQL query. This error occurs when the result assigning to the array. Fields without alias are works fine.
$strSql="SELECT PROCODE, SUM(TBLPRODUCT.SIH) AS SIH FROM PRODUCTTABLE GROUP BY PROCODE";
$result = odbc_exec($con,$strSql) or die();
if (odbc_num_rows($result) > 0) {
$result = odbc_fetch_array($result,0);
$product = array();
$product["psku"] = $result["PROCODE"];
$product["sih"] = $result["SIH"];
}
I'm using PHP version PHP Version 5.5.24 and the same code works fine on another pc with a different PHP version. What could be the issue?
Thanks :)