title: Zend secure sql queries?
body: <p>I was wondering if something like this, is safe in Zend: </p>
  
  <pre><code>$db = Zend_Registry::get('db');
  $query = "SELECT * FROM tags t JOIN posts_tags pt ON pt.tag_id = t.tag_id where pt.post_id = " . $postid;
  $select = $db-&gt;query();
  </code></pre>
  
  <p>I'm not checking the content of <code>$postid</code> is here.</p>
  
  <p>Zend does this automatically when you make queries like this:</p>
  
  <pre><code>$db = Zend_Registry::get('db');
  $select = $db-&gt;select();
  $select-&gt;from(array('p' =&gt; 'posts'))
      -&gt;join(array('u' =&gt; 'users'), 'u.user_id = p.post_userid')
      -&gt;where('p.post_id = ?', $postid);
  </code></pre>
  
  <p>But I don't like this way of working, just writing queries is much faster for me. So should I be manually escaping or is this done for me? And what are the easiest ways to do this?</p>