title: Throw an exception with the SQL error message
body: <p>I am getting an error in this code:</p>
  
  <pre><code>try
          {
              $db = parent::getConnection();
              if($this-&gt;id == 0 )
              {
                  $query = 'insert into articles (modified, username, url, title, description, points )';
                  $query .= " values ('$this-&gt;getModified()', '$this-&gt;username', '$this-&gt;url', '$this-&gt;title', '$this-&gt;description', '$this-&gt;points' )";
  
              }
              else if($this-&gt;id != 0)
              {
  
                  $query = "update articles set modified = CURRENT_TIMESTAMP, username = '$this-&gt;username', url = '$this-&gt;url', title = '$this-&gt;title', description = '$this-&gt;description', points = '$this-&gt;points', ranking = '$this-&gt;ranking' where id = '$this-&gt;id' ";
              }
  
              $lastid = parent::execSql2($query);
  
              if($this-&gt;id == 0 )
                  $this-&gt;id = $lastid;
  
          }
          catch(Exception $e){
              error_log($e);
          }
  </code></pre>
  
  <p>What do I have to add so I get some meaningful SQL error message?</p>
  
  <p>(It seems for some queries its not getting the user name)</p>
  
  <p>Edit: I get this error log:</p>
  
  <pre><code>[18-Mar-2011 05:19:13] exception 'Exception' in /home1/mexautos/public_html/kiubbo/data/model.php:90
  Stack trace:
  #0 /home1/mexautos/public_html/kiubbo/data/article.php(276): Model::execSQl2('update articles...')
  #1 /home1/mexautos/public_html/kiubbo/data/article.php(111): Article-&gt;save()
  #2 /home1/mexautos/public_html/kiubbo/pages/frontpage.php(21): Article-&gt;calculateRanking()
  #3 /home1/mexautos/public_html/kiubbo/pages/frontpage.php(27): FrontPage-&gt;updateRanking()
  #4 /home1/mexautos/public_html/kiubbo/index.php(15): FrontPage-&gt;showTopArticles('426')
  #5 {main}
  </code></pre>
  
  <p>Thank you,</p>
  
  <p>Regards,</p>
  
  <p>Carlos</p>