Return to Snippet

Revision: 64559
at August 22, 2013 18:40 by brownrl


Initial Code
<snippet>
  <content><![CDATA[

\$q = "SELECT COUNT( * ) AS total FROM ${1:table} WHERE ${2:field} = '".${3:value}."'";
\$qr = dbQuery( \$q );
\$qrow = dbFetchArray( \$qr );
\$total = \$qrow['total'];

]]></content>
  <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
  <tabTrigger>dbNumRows</tabTrigger>
  <!-- Optional: Set a scope to limit where the snippet will trigger -->
  <!-- <scope>source.python</scope> -->
</snippet>

Initial URL
http://www.itsgooto.be/cv.php

Initial Description
When using PDO with sQlite ->rowCount() doesn't work. the recommendation is to do a pre query to get the number. Thus, I created this snippet to help things along.

Initial Title
Sublime Snippet: dbNumRows

Initial Tags
sql, php

Initial Language
PHP