Skip to content

Instantly share code, notes, and snippets.

@nmfzone
Last active April 16, 2022 08:49
Show Gist options
  • Save nmfzone/f94a66b4cd4896a809d9f4d181dce3f5 to your computer and use it in GitHub Desktop.
Save nmfzone/f94a66b4cd4896a809d9f4d181dce3f5 to your computer and use it in GitHub Desktop.
Mysqli Result
function mysqli_result($res, $row=0, $col=0){
$numrows = mysqli_num_rows($res);
if ($numrows && $row <= ($numrows-1) && $row >=0){
mysqli_data_seek($res,$row);
$resrow = (is_numeric($col)) ? mysqli_fetch_row($res) : mysqli_fetch_assoc($res);
if (isset($resrow[$col])) {
return $resrow[$col];
}
}
return false;
}
$nama = mysqli_result(mysqli_query($connection, "SELECT nama FROM users WHERE id=1"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment