Posted By

brownrl on 08/22/13


Tagged

sql php db snippet sublime numrows


Versions (?)

Sublime Snippet: dbNumRows


 / Published in: PHP
 

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

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.

  1. <snippet>
  2. <content><![CDATA[
  3.  
  4. \$q = "SELECT COUNT( * ) AS total FROM ${1:table} WHERE ${2:field} = '".${3:value}."'";
  5. \$qr = dbQuery( \$q );
  6. \$qrow = dbFetchArray( \$qr );
  7. \$total = \$qrow['total'];
  8.  
  9. ]]></content>
  10. <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
  11. <tabTrigger>dbNumRows</tabTrigger>
  12. <!-- Optional: Set a scope to limit where the snippet will trigger -->
  13. <!-- <scope>source.python</scope> -->
  14. </snippet>

Report this snippet   <

You need to login to post a comment.