Call to undefined function mysql_query() with Login
<p>When i execute my <strong>PHP</strong> code below i get a <strong>Fatal error</strong> and i'm not sure how to resolve it.</p>

<p>Thank you for your help</p>

<p><strong>The Error</strong></p>

<blockquote>
  <p>PHP Fatal error:  Uncaught Error: Call to undefined function mysql_query() in /Applications/MAMP/htdocs/lprapp/config.php:23
  Stack trace:#0 {main}
    thrown in /Applications/MAMP/htdocs/lprapp/config.php on line 23   </p>
</blockquote>

<p><strong>Code</strong></p>

<pre><code>    &lt;?php

    $user = 'root';
    $password = 'root';
    $db = 'inventory';
    $host = 'localhost';
    $port = 8888;

    $link = mysqli_init();
    $success = mysqli_real_connect(
       $link,
       $host,
       $user,
       $password,
       $db,
       $port
    );

    ?&gt;
    &lt;?php
    $username = $_POST['username'];
    $password = $_POST['password'];
    $sql = mysql_query("SELECT * FROM login WHERE username = '".$_POST['username']."' and password = '".md5($_POST['password'])."'");
    $row = mysql_num_rows($sql);
    if($rom &gt; 0 )
    {
      session_start();
      $_SESSION['username'] = $_POST['username'];
      $_SESSION['password'] = $_POST['password'];
      echo "login done";
    }else {
      echo "fail login ";
    }

    ?&gt;
</code></pre>