PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/include/adodb/tests/testpear.php

https://github.com/radicaldesigns/amp
PHP | 34 lines | 20 code | 5 blank | 9 comment | 3 complexity | 83e8845b290525e5b78610bf2b505038 MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0, BSD-3-Clause, LGPL-2.0, CC-BY-SA-3.0, AGPL-1.0
  1. <?php
  2. /*
  3. V4.80 8 Mar 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
  4. Released under both BSD license and Lesser GPL library license.
  5. Whenever there is any discrepancy between the two licenses,
  6. the BSD license will take precedence.
  7. Set tabs to 4 for best viewing.
  8. Latest version is available at http://adodb.sourceforge.net
  9. */
  10. error_reporting(E_ALL);
  11. include_once('../adodb-pear.inc.php');
  12. $username = 'root';
  13. $password = '';
  14. $hostname = 'localhost';
  15. $databasename = 'xphplens';
  16. $driver = 'mysql';
  17. $dsn = "$driver://$username:$password@$hostname/$databasename";
  18. $db = DB::Connect($dsn);
  19. $db->setFetchMode(ADODB_FETCH_ASSOC);
  20. $rs = $db->Query('select firstname,lastname from adoxyz');
  21. $cnt = 0;
  22. while ($arr = $rs->FetchRow()) {
  23. print_r($arr);
  24. print "<br>";
  25. $cnt += 1;
  26. }
  27. if ($cnt != 50) print "<b>Error in \$cnt = $cnt</b>";
  28. ?>