title: How to use mysql_field_len in PHP 7?
body: <p>I'm new with PHP 7 and updating the code into PHP 7. I got error below when trying to get length as mysql_field_len() as it is not exist in mysqli, so how to solved this?</p>
  
  <p>My problem is in this line >>>  $panjang    = mysql_field_len($query,0);</p>
  
  <blockquote>
    <p>Warning: mysql_field_len() expects parameter 1 to be resource, object
    given in</p>
  </blockquote>
  
  <pre><code>function WriteCode($tabel, $inisial){
      $server = "localhost";
      $username = "user_db";
      $password   = "password_db";
      $database   = "name_db";
      $connection = mysqli_connect($server,$username,$password);
      if (!$connection) {
          die("Database connection failed: " . mysqli_error($connection));
      }
      $db_select = mysqli_select_db($connection, $database);
      if (!$db_select) {
          die("Database selection failed: " . mysqli_error($connection));
      }
      $query  = mysqli_query($connection,"SELECT * FROM $tabel");
      $panjang = mysql_field_len($query,0);
      $qry = mysqli_query($connection,"SELECT MAX('.$property.') FROM ".$tabel);
      if (!$qry) {
          printf("Error: %s\n", mysqli_error($connection));
          exit();
      }
      $row = mysqli_fetch_array($qry, MYSQLI_NUM);
      if ($row[0]=="") {
          $angka=0;
      }
      else {
          $angka  = substr($row[0], strlen($inisial));
      }
      $angka++;
      $angka  =strval($angka); 
      $tmp    ="";
      for($i=1; $i&lt;=($panjang-strlen($inisial)-strlen($angka)); $i++) {
          $tmp=$tmp."0";  
      }
      return $inisial.$tmp.$angka;
  </code></pre>
  
  <p>Thank You</p>