PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Waqas Ahmed   SQLite and MySQL   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: SQLite test script
Class: SQLite and MySQL
Access MySQL and SQLite databases
Author: By
Last change:
Date: 14 years ago
Size: 619 bytes
 

Contents

Class file image Download
<?php

require_once 'SQLite.php';
$sql = "SELECT * FROM foo";

try {
   
   
$connection = new SQLite("Book Store", "BookStore.sqlite");
   
    if (
$connection->IsOpen()) {
       
       
$resultSet = $connection->Execute($sql);
       
    } else {
       
        echo
'Cannot Perform the Task!';
       
    }
   
   
$content = null;
   
    if (
$resultSet!=NULL) {
       
        while (
$resultSet->MoveNext()) {
           
           
$content .= $resultSet->Field(0) . " " . $resultSet->Field(1) . '<br>';
   
        }
       
    } else {
       
        echo
'No Data in the Query!';
       
    }
   
    echo
$content;
   
} catch (
Exception $e) {
   
   
$e->getTraceAsString();
   
}


?>