Database connect in PHP 7 : <p>but i do not understand what i am doing wrong and why it is not working ? </p>

<p>Seems like it connects with DB, but it wont update DB table. </p>

<p>My PHP code </p>

<pre><code>&lt;?php
        $host = 'localhost';
        $db_name = 'db_name';
        $db_user = 'user'; 
        $db_password = 'password';

        $con = mysqli_connect($host, $db_user, $db_password, $db_name);
            if (!$con) {
    die("Connection failed: " . mysqli_connect_error());
}
        function _VoteReward($custom)
             {
                $sql = "UPDATE `users` SET `gold` = `gold` + 50000 WHERE `id` = '".$custom."' ";

                mysqli_query($con, $sql);
            }


            $custom = $_POST["custom"];
            $key = $_POST["key"];
            $result = false;

                if (($custom &gt; 0) &amp;&amp; ($key == 'key'))
            { 
                $result = true;
                _VoteReward($custom);

                }
    mysqli_close($con);

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