Source for file fetch_result_all.php

Documentation is available at fetch_result_all.php

  1. <?php
  2. /**
  3. * FetchResult All Example
  4. *
  5. * This example uses the FetchResult[Assoc, Object, Row]All functions to retrieve the all query results.
  6. * The method shown in this example uses FetchResultRowAll but the other functions would be used in the
  7. * same way.
  8. * @package AbstractDB
  9. * @author Pacific-Cybersoft
  10. * @copyright (C) 2005 Pacific-Cybersoft. All Rights Reserved.
  11. * @version v 1.0.2
  12. * @license http://www.gnu.org/copyleft/lesser.txt GNU Lesser General Public License
  13. */
  14.  
  15. /**
  16. * Include the AbstractDB main class.
  17. */
  18. include("../abstractdb.class.php");
  19.  
  20. // Instatiate AbstractDB
  21. $db = new AbstractDB(array("ConnectionString"=>"mysql://username:password@localhost/mydatabase"));
  22. // Execute a Query
  23. if($rs = $db->Query("SELECT * FROM tablename"))
  24. {
  25. // Get the result
  26. $db->FetchResultRowAll($rs, $all);
  27. // Do something with the data in $all.
  28. foreach($all as $row)
  29. {
  30. print_r($row);
  31. }
  32. }
  33. else
  34. {
  35. die($db->GetLastError());
  36. }
  37. // Always good practice to close AbstractDB at the end of each script.
  38. $db->Close();
  39. ?>

Documentation generated on Wed, 16 Mar 2005 23:17:21 +1100 by phpDocumentor 1.3.0RC3