What is secure way to use PHP variables in PDO queries?
<p>Yesterday a post a question about how to Update using PDO, and some users told me that the folowing code line is very unsafe, because everybody can modifie my database. Well I undestrand why is not safe but <strong>what should I do with my variables berofe use it in mysql?</strong> </p>

<p>Example of unsafe use:</p>

<pre><code>$bdd-&gt;prepare("UPDATE `articulos` SET `visto` = `visto` + 1 WHERE `ID` =$_GET['variable'] ");
</code></pre>

<p>I gues that if a use <code>$_POST</code> it still not secure.</p>

<p>And if I do this is unsafe too: </p>

<pre><code>$getVar=$_GET['variable'];

$bdd-&gt;prepare("UPDATE `articulos` SET `visto` = `visto` + 1 WHERE `ID` =$getVar ")
</code></pre>

<p><strong>So what is the safe way to insert variables in SQL queries?</strong></p>

<p>Thak you.</p>