I have this error:

> 
> Call to a member function bind\_param() on a non-object 
>  in /home/ccraft50/public\_html/C-Blog/InsertDataPosts.php on line 15
> 
> 
> 

---

```
   <?php
$servername2 = "localhost";
$username2 = "My DB";
$password2 = "My Pass";
$dbname2 = "My DB";
// Create connection
$dbconn2 = new mysqli($servername2, $username2, $password2, $dbname2);
// Check connection
if ($dbconn2->connect_error) {
    die("Connection failed: " . $dbconn2->connect_error);
 } 
$insIndexData = $dbconn2->prepare("INSERT INTO " . str_replace(str_split('\\/:*?"<>|.$+-%#@!~&;\',=~` '), "_", $_POST['filename']) . "_Index (SubjectName, IndexData) VALUES (?, ?)");

$str_prot_index = array('<script>', '</script>', '<?php', '?>', '<html', '</html>', '<body', '</body>', '<head', '</head>', '<pre', '</pre>', '<div', '</div>');
$insIndexData->bind_param('ss', $_POST['filename'], str_replace($str_prot_index, '', $_POST['comment']));
$insIndexData->execute();
$insIndexData->close();

if($dbconn2->prepare($insIndexData)) {
        echo "Successfuly Insert data for index!";
} else {
    echo "Error: " . $dbconn2->error;
}

$dbconn2->close();
?>

```