WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : SQLite PHP Database Wrapper
Categories : PHP, PHP Classes, Databases, SQLite, Beginner Guides Click here to Update Your Picture
Alix Axel
Date : Apr 28th 2009
Grade : 1 of 5 (graded 1 times)
Viewed : 4492
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Alix Axel
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
Like this code?
Show the author your appreciation.
 

A minimalistic wrapper for SQLite Databases.
<?php

class SQLite
{
    public
$connection = null;

    function
Affected_Rows()
    {
        if (
is_resource($this->connection) === true)
        {
            return
sqlite_changes($this->connection);
        }

        return
false;
    }

    function
Connect($database)
    {
        if (
is_file($database) === true)
        {
           
$this->connection = sqlite_open($database) or trigger_error(sqlite_error_string(sqlite_last_error($this->connection)), E_USER_ERROR);

            if (
is_resource($this->connection) === true)
            {
                return
true;
            }
        }

        return
false;
    }

    function
Disconnect()
    {
        if (
is_resource($this->connection) === true)
        {
            return
sqlite_close($this->connection);
        }

        return
false;
    }

    function
Insert_ID()
    {
        if (
is_resource($this->connection) === true)
        {
            return
sqlite_last_insert_rowid($this->connection);
        }

        return
false;
    }

    function
Query($sql, $type = 'assoc')
    {
        if (
is_resource($this->connection) === true)
        {
           
$query = sqlite_query($this->connection, $sql) or trigger_error(sqlite_error_string(sqlite_last_error($this->connection)), E_USER_WARNING);

            if (
is_resource($query) === true)
            {
                return
sqlite_fetch_all($query, constant('SQLITE_' . strtoupper($type)));
            }

            if (
$query === true)
            {
                switch (
strtoupper(substr(trim($sql), 0, strpos(trim($sql), ' '))))
                {
                    case
'INSERT':
                        return
$this->Insert_ID();
                    break;

                    case
'UPDATE':
                    case
'REPLACE':
                    case
'DELETE':
                        return
$this->Affected_Rows();
                    break;
                }

                return
true;
            }
        }

        return
false;
    }

    function
Quote($string)
    {
        if (
get_magic_quotes_gpc() === true)
        {
           
$string = stripslashes($string);
        }

        return
'\'' . sqlite_escape_string(trim($string)) . '\'';
    }

    function
Tick($string)
    {
       
$string = explode('.', str_replace(array('[', ']'), '', $string));

        foreach (
$string as $key => $value)
        {
            if (
$value != '*')
            {
               
$string[$key] = '[' . trim($value) . ']';
            }
        }

        return
implode('.', $string);
    }
}
?>


Usage:
Identical to http://www.weberdev.com/get_example-4811.html



Specify your connection settings and create a link to a MySQL database.
Categories : PHP, PHP Classes, Databases, MySQL, Beginner Guides
PHP5 SQLite Abstraction class
Categories : PHP, PHP Classes, SQLite, Databases
mySQL/PHP/search with multientry form and table output with colored rows
Categories : PHP, Beginner Guides, MySQL, HTML and PHP, Databases
Mssql database Manager
Categories : PHP, Databases, MS SQL Server, Classes and Objects, PHP Classes
A beginner's session handling class
Categories : PHP, PHP Classes, Sessions, Beginner Guides
Database and Recordset classes fo SyBASE Usage is obvious.
Categories : Sybase, Databases, PHP Classes, PHP
Recordset Class like ADO Recordset (plus DataBase Splitting feature) using ODBC functions
Categories : PHP Classes, ODBC, Databases, PHP
Setting up InnoDB on MySQL and using Transactions Begin, Commit, Rollback in PHP.
Categories : PHP Classes, Databases, PHP, MySQL, InnoDB
PHP Object Example of the Perl DBI with MySQL
Categories : PHP, PHP Classes, MySQL, Databases, Perl
Link Manager for Link Exchangers
Categories : PHP, PHP Classes, Databases, MySQL, CURL
A script to generate a report from a valid mysql connection. The user has to supply which fields he wants to display in table. All properties are changable.
Categories : PHP, PHP Classes, Databases, MySQL, HTML and PHP
This is a class with functions that are taken from simple SQL statements. I made it to have an easier connection between PHP3 and DBase files.
Categories : General SQL, PHP, PHP Classes, Databases
Simple database class
Categories : PHP, PHP Classes, MySQL, Databases
Ajax PHP Tree (Left and Right) with MySQL
Categories : PHP, Databases, MySQL, AJAX, PHP Classes
YellowPages Content Grabber (PHP5 +)
Categories : PHP, PHP Classes, Regexps, Databases, MySQL