Sublime Snippet: dbNumRows


/ Published in: PHP
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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>

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.