Source for file t_num_rows.php

Documentation is available at t_num_rows.php

  1. #!/usr/local/bin/php
  2. <?php
  3. /**
  4.  * Examples how to use the NumRows() and AffectedRows().
  5.  * @author Sascha 'SieGeL' Pfalz <php@saschapfalz.de>
  6.  * @package db_MySQL
  7.  * @subpackage Examples
  8.  * @version 0.39 (07-Aug-2010)
  9.  *  $Id: t_num_rows.php,v 1.3 2010/08/07 08:16:16 siegel Exp $
  10.  * @license http://opensource.org/licenses/bsd-license.php BSD License
  11.  * @filesource
  12.  */
  13. /**
  14.  */
  15. require('functions.inc.php');
  16. $db new db_MySQL('./dbdefs.inc.php');
  17. $d WhichBR();
  18. if($d['SAPI'!= 'cli')
  19.   {
  20.   echo("<pre>\n");
  21.   }
  22. $db->Connect();
  23. $db->Query('SHOW TABLES');
  24. printf("There are %d tables stored in database %s\n",$db->NumRows(),MYSQLDB_DATABASE);
  25.  
  26. // Now do the same with QueryResult, just to make sure everything works:
  27.  
  28. $stmt $db->QueryResult('SHOW TABLES');
  29. printf("There are %d tables stored in database %s\n",$db->NumRows(),MYSQLDB_DATABASE);
  30. $db->FreeResult($stmt);
  31.  
  32. $db->Disconnect();
  33. exit;
  34. ?>

Documentation generated on Sat, 07 Aug 2010 10:18:28 +0200 by phpDocumentor 1.4.3