Login   Register  
PHP Classes
elePHPant
Icontem

File: sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Erik Giberti  >  sqltoolkit  >  sample.php  >  Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Sample Usage and Test
Class: sqltoolkit
An API for interfacing with databases
Author: By
Last change:
Date: 2003-03-13 14:11
Size: 1,047 bytes
 

Contents

Class file image Download
<html>
<head>
<title>Sample Usage</title>
</head>
<body bgcolor="white">
<h1>Sample Usage of sql.php</h1>
<h2>A Quick Start</h2>
<p>1. Include the code in you page</p>
<pre>
    require("sql.php");
</pre>

<p>2a. Run a "quick" query which will handle all the open and closing of the database connections for you.</p>
<pre>
    $result = database_quick_query($datasource_mysql, "select * from test");
</pre>

<p>or</p>

<p>2b. Manage your own connections and run querys</p>
<pre>
    $connection = database_connect($datasource_pg);
    $result     = database_query($connection, "select * from test");
    database_close($connection);
</pre>

<p>3. Do something with the results</p>
<pre>
    database_result_dump($result);
</pre>

<p>That's it!</p>

<hr />

<p>If you have configured your datasource_config.php file already, you may actually see a result set below:</p>

<?php
require("sql.php");
$result = @database_quick_query($datasource_mysql"select * from test");
@
database_result_dump($result);
?>

</body>
</html>