Source for file fetch_result.php

Documentation is available at fetch_result.php

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

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