Source for file query_result_all.php

Documentation is available at query_result_all.php

  1. <?php
  2. /**
  3. * Query All Example
  4. *
  5. * This example uses the Query[Assoc, Object, Row]All functions to retrieve the all query results.
  6. * The method shown in this example uses QueryRowAll 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->QueryRowAll("SELECT * FROM tablename", $all))
  24. {
  25. // Do something with the data in $all.
  26. foreach($all as $row)
  27. {
  28. print_r($row);
  29. }
  30. }
  31. else
  32. {
  33. die($db->GetLastError());
  34. }
  35. // Always good practice to close AbstractDB at the end of each script.
  36. $db->Close();
  37. ?>

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