title: I need to join two tables in php
body: <p>I need to insert image row from table 'users2' to 'allbets'. But suddenlly this code don't working and I don't know why.. What is wrong with this?</p>
  
  <pre><code>$q2 = $pdo-&gt;prepare('INSERT INTO allbets (image) SELECT users2.image FROM users2 WHERE username = ?');
  $q2-&gt;bindValue(1, $_SESSION['name']);
  $q2 -&gt; execute();
  </code></pre>