SELECTING Multiple Rows with an Array and then INSERT to another statement
<p>I am trying to SELECT data from one table based on the ID and then INSERT the returned data in to another table.</p>

<p>My code is:</p>

<pre><code>&lt;?php
    require '../../db-config.php';

    if(isset($_POST['course'])) {
        $selected_courses = '('. implode(',', $_POST['course']) .')';
        $status = 'Live';
        $active = 'Y';

        $stmt = "SELECT id, coursetitle FROM courses WHERE id IN ". $selected_courses ." 
                 AND status = ?";
        $stmt = $conn-&gt;prepare($stmt);
        $stmt-&gt;bind_param('i', $selected_courses);
        $stmt-&gt;execute();
        $stmt-&gt;bind_result($id, $coursetitle);

        while($stmt-&gt;fetch()) {
            $stmt = $conn-&gt;prepare("INSERT INTO distributor_course_settings
                                  (id, active, coursetitle) VALUES (?, ?, ?)");
            $stmt-&gt;bind_param("iss", $id, $active, $coursetitle);
            $stmt-&gt;execute();
        }
    }
?&gt;
</code></pre>

<blockquote>
  <p>The error I am getting is: PHP Fatal error: Call to a member function
  bind_param() on boolean</p>
</blockquote>

<p>What is wrong with my code?</p>