php - Why does this version mysqli result work? -


the following code describes substitute mysql function mysql_result. since there none in mysqli, found code same exact thing, except user-created function. reason using function because need data different tables.

<?php   function mysqli_result($res, $row, $field=0) {   $res->data_seek($row);   $datarow = $res->fetch_array();   return $datarow[$field];  }  ?>  

the arguments same mysql_result.br> after reading php functions, having problem understanding:

  • what difference between $field=0 , $field
  • i think found similar on object oriented statements, $res->data_seek($row); set $res equal data seek of $row? $row row one, $res select row 1 of tables selected?

  1. read default function parameters in manual. if caller not supply value third parameter ($field), set 0 default.

  2. read oop basis in manual.
    $res->data_seek($row); calls method called data_seek on res object 1 parameter, object row. depends on data_seek() whether supplied object (objects passed reference) modified.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -