A few days ago I have developed a PHP project with mssql server database. Right now I need to change the MSSQL database to MySQL database. Previously I have used the odbc_result
method but I am converting the all methods of odbc to those of mysqli procedural. So I need a function that works like odbc_result
for mysqli – which one is it? I am trying to use mysqli_result
but it throws an error "Call to undefined function mysqli_result()".
Below I have menthid the function:
function checkCountry($con)
{
if ($con != '') {
$cCodeList = array();
$i = 0;
$checkCountrySql = "SELECT country_code FROM country";
$checkCountyResult = mysqli_query($con, $checkCountrySql);
while (mysqli_fetch_row($checkCountyResult)) {
for ($j = 1; $j <= mysqli_num_fields($checkCountyResult); $j++) {
$ar = mysqli_result($checkCountyResult, $j);
}
$cCodeList[$i] = $ar;
$i++;
}
return $cCodeList;
}
}
So what is the alternative of odbc_result
for mysqli?