Symfony2 + DBAL. How to use bindValue for multiple insert?
<p>I'm using DBAL and I want to execute multiple insert query. But I have the problem: <code>bindValue()</code> method not working in loop. This is my code:</p>

<pre><code>    $insertQuery = "INSERT INTO `phonebook`(`number`, `company`, `user`) VALUES %s 
           ON DUPLICATE KEY UPDATE company=VALUES(company), user=VALUES(user)";

    for ($i = 0; $i &lt; count($data); $i++) {
        $inserted[] = "(':number', ':company', ':user')";
    }

    $insertQuery = sprintf($insertQuery, implode(",", $inserted));
    $result = $db-&gt;getConnection()-&gt;prepare($insertQuery);

    for ($i = 0; $i &lt; count($data); $i++) {
        $result-&gt;bindValue($data[$i]["number"]);
        $result-&gt;bindValue($data[$i]["company"]);
        $result-&gt;bindValue($data[$i]["user"]);
    }

    $result-&gt;execute();
</code></pre>

<p>As result I received one-line table with fields: <code>:number</code>, <code>:company</code>, <code>:user</code>.</p>

<p>What am I doing wrong?</p>

<p>Thanks a lot for any help!</p>