PDO insert statement with variables
<p>I'm trying to create an insert statement via PDO with variables but always get following error</p>

<pre><code>Fatal error: Uncaught Error: Call to a member function prepare() on null in /Applications/XAMPP/xamppfiles/htdocs/Jobber/user.php:9 Stack trace: #0 /Applications/XAMPP/xamppfiles/htdocs/jobber/usercheck.php(3): Users-&gt;__construct('steve', 'testt@test.com', 'test', 1) #1 {main} thrown in /Applications/XAMPP/xamppfiles/htdocs/Jobber/user.php on line 9
</code></pre>

<p>this is the code I'm using for it</p>

<pre><code>class Users{
        private $connect ;

        function __construct($name,$email,$password,$usertype){
            include("connect.php");
            $startDb = new Connect();
            $this-&gt;connect = $startDb-&gt;getDb();
            $sqlquery = $this-&gt;connect-&gt;prepare("INSERT INTO `user`( `Username`, `Email`, `Active`, `Password`, `usertype`) VALUES (" + $name + "," +$email +",0," + $password + "," + $usertype + ")");
            $sqlquery-&gt;execute();
        }       
    }
</code></pre>

<p>Is there a problem with the connection or is it something else with the variables?</p>

<p>this is the connect class</p>

<pre><code>class Connect{      
        private $host = "localhost:8080";
        private $user = "root";
        private $password = "test";
        private $dbName = "jobber";
        private $db;

        function __construct(){
            try{
                $connection = new PDO('mysql:host=localhost;dbname=jobber',$this-&gt;user,$this-&gt;password);
            }catch(PDOException $ex){
                echo $ex;
            }
        }

        function getDb(){
            if($this-&gt;db instanceof PDO){
                return $this-&gt;db;
            }
        }
    }
</code></pre>