Skip to content

Instantly share code, notes, and snippets.

@sicksand
Created April 1, 2015 04:47
Show Gist options
  • Save sicksand/66d65158000a29c298ae to your computer and use it in GitHub Desktop.
Save sicksand/66d65158000a29c298ae to your computer and use it in GitHub Desktop.
Use this function if you have legacy PHP script < 5.5 that use (mysql_result) to get result from mysql.
<?php
/*
* mysql_result.php
*
* @author Shafiq Mustapa<[email protected]>
* @created 1st April 2015
* @version 1.0
* @desc Use this function if you have legacy PHP script < 5.5 that use (mysql_result) to get result from mysql.
*/
function mysqli_result($res,$row=0,$col=0){
if ($row >= 0 && mysqli_num_rows($res) > $row){
mysqli_data_seek($res,$row);
$resrow = mysqli_fetch_row($res);
if (isset($resrow[$col])){
return $resrow[$col];
}
}
return false;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment