Source for file functions.inc.php

Documentation is available at functions.inc.php

  1. <?php
  2. /**
  3.  * Set of functions used in the MySQL examples.
  4.  * @package db_MySQL
  5.  * @subpackage Examples
  6.  * @author Sascha 'SieGeL' Pfalz <php@saschapfalz.de>
  7.  * @version 0.36 (21-Sep-2008)
  8.  *  $Id: functions.inc.php,v 1.4 2010/01/23 10:48:47 siegel Exp $
  9.  * @license http://opensource.org/licenses/bsd-license.php BSD License
  10.  * @filesource
  11.  */
  12. ini_set('error_reporting' E_ALL|E_NOTICE|E_STRICT);
  13. /**
  14.  * Load in the class so that the examples are working.
  15.  */
  16. require_once('../mysqldb_class.php');
  17.  
  18. /**
  19.  * Returns an associative array with sapi-type name and required line break char.
  20.  * Use this function to retrieve the required line-break character for both the
  21.  * browser output and shell output. Currently only two keys are included:
  22.  * - "SAPI" => The sapi type of PHP (i.e. "cli")
  23.  * - "LF"   => The line-break character to use (i.e. "<br>")
  24.  * @return array The associative array as described.
  25.  */
  26. function WhichBR()
  27.   {
  28.   $data array();
  29.   $data['SAPI'php_sapi_name();
  30.   switch($data['SAPI'])
  31.     {
  32.     case  'cli':
  33.           $data['LF'"\n";
  34.           $data['HR'"------------------------------------------------------------------------------\n";
  35.           break;
  36.     default:
  37.           $data['LF'"<br>";
  38.           $data['HR'"<hr>";
  39.           break;
  40.     }
  41.   return($data);
  42.   }
  43.  
  44. /**
  45.  * Prints out the amount of queries and the time required to process them.
  46.  * @param string $lf The linefeed character to use.
  47.  * @param mixed &$dbh The database object.
  48.  */
  49. function DBFooter($lf&$dbh)
  50.   {
  51.   printf("Queries: %d | Time required: %5.3fs%s",$dbh->GetQueryCount(),$dbh->GetQueryTime(),$lf);
  52.   }
  53. ?>

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