mysqli_real_escape_string() expects parameter 1 to be mysqli
<p>Here is my complete code....</p>

<p>Connect.php</p>

<pre><code>$connect = @mysql_connect ($host, $username, $password, $db_name) or die ('error');
$select = @mysql_select_db($db_name, $connect) or die('check');
</code></pre>

<p>password .php
    

<pre><code>//forgot password update

include('C:\wamp\www\header.html');

//check if form has been submitted
include('C:\wamp\www\connect.php');


    //connecting to db
    $errors = array();


if(isset($_POST['submitted'])) {



    if (empty($_POST['username']))

    {
        $errors[]='Please enter a username.';
    }

    else
    {
      $u = mysqli_real_escape_string($connect,trim($_POST['username']));
    }

    //check for current password
    if (empty($_POST['password']))

    {
        $errors[]='Current password does not match.';
    }

    else
    {
      $p = mysqli_real_escape_string($connect,trim($_POST['password']));
    }

    //check for a new password and match with confirm pass.

    if(!empty($_POST['password1']))
    {
        if($_POST['password1'] != $_POST['cpass'])
        {
            $errors[] = 'The entered password and confirm password do not match.';
        }
        else
        {
            $np = mysqli_real_escape_string($connect,trim($_POST['password1']));
        }
    }
    if(empty($errors)){
    //if everything is fine.

    //verify the entered email address and password.

    $q="SELECT username FROM users WHERE (username='$u' AND password=SHA1('$p'))";
    $r=@mysqli_query($connect,$q);
    $num = @mysqli_num_rows($r);
    if($num==1)
    //if it matches.

    //get user id
    {
    $row=mysqli_fetch_array($r, MYSQLI_NUM);

    //udpdate query.

    $q="UPDATE users SET password= SHA1('$np') WHERE username=$row[0]";

    $r=@mysqli_query($connect, $q);

    if (mysqli_affected_rows($connect) ==1)

    {
        echo '&lt;h3&gt;Your password has been updated.&lt;/h3&gt;';
    }

    else {
        echo '&lt;h3&gt;Whops! Your password cannot be changed due a system error. Try again later. Sorry&lt;/h3&gt;';

    echo '&lt;p&gt;' .mysqli_error($connect). 'Query:' . $q.'&lt;/p&gt;';
    }


    exit();
    }
    else 
    {

        //invalid email and password

        echo 'The entered username and password do not match.';
    }

}
    else 
    {
        //report the errors.

    echo '&lt;h1&gt; Err... &lt;/h1&gt;
    &lt;p&gt; The following error(s) have occured&lt;/p&gt;';

    foreach ($errors as $msg)
        {
            echo "--$msg&lt;br /&gt;\n";
        }
        echo '&lt;/p&gt;&lt;p&gt;Please Try Again.&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;';

    }
    mysqli_close($connect);
}

    ?&gt;

&lt;html&gt;
&lt;head&gt;&lt;/head&gt;
&lt;body&gt;
&lt;div id="container"&gt;
&lt;h1&gt;Change your password&lt;/h1&gt;
&lt;form action="password.php" method="post"&gt;
Username:&lt;br&gt;
&lt;input type="text" name="username" size="20" maxlength="80" /&gt;
&lt;br&gt;
Current Password&lt;br/&gt;
&lt;input type="password" name="password" /&gt;
&lt;br/&gt;
New Password&lt;br/&gt;
&lt;input type="password" name="password1" /&gt;
&lt;br/&gt;
Confirm New Password&lt;br/&gt;
&lt;input type="password" name="cpass" /&gt;
&lt;br/&gt;
&lt;input type="submit" name="submit" value="Change Password"/&gt;
&lt;input type="hidden" name="submitted" value="TRUE"/&gt;
&lt;/form&gt;
&lt;/div&gt;

&lt;?php
include('C:\wamp\www\footer.html');
?&gt;
</code></pre>
