I am a new programmer and I can not get my fields to be stored in the database from a registration form
<p>If I declare a global variable such as a database connection of $mysqli how do I use that in a class. i am trying to use it in my user class. Do i store it as a public variable in the class or as a global in the function itself. I also think there is something wrong with my following code but I may be wrong.</p>

<pre><code>class USER 
{

    function __constructor()
    {
    }

    /*
    * adds a new user
    * returns FALSE on error
    * returns user id on success
    */
    function add_member($name, $email, $password)
    {
        global $mysqli;

        $query = "INSERT INTO members
              SET 
              user_name = {'$name'},
              user_email = {'$email'},
              password = ['$password'}";

        $success = $mysqli -&gt; query ($query);         

        if (!$success || $mysqli -&gt; affected_rows == 0)
        {
            echo "&lt;p&gt; An error occurred: you just are not tough enough!!!&lt;/p&gt;";           
            return FALSE;
        } 

        $uid = $mysqli -&gt; insert_id;
        return $uid;

    }
} // end class
$uc = new USER();

?&gt;

    &lt;?php

require_once ('includes/classes/database.php');
require_once('includes/classes/user.php');
require_once('includes/header.php');


// if user submits a new registration
if (isset($_POST['name'],$_POST['email'],$_POST['pwd'],$_POST['pwd2']))
{
    // validate input fields
    $name = $_POST['name'];
    $email = $_POST['email'];
    $password = $_POST['pwd'];
    $password2 = $_POST['pwd2'];

    // if error fall through and redisplay page with errors

    // if no errors update database and redirect to homepage
    if ($uc-&gt;add_member($name, $email, $password) === FALSE)
    {
        echo "System Error. damn if I know what to do";
    } 
    else
    {
        header("location: homepage.php");
    }
}
</code></pre>
