Database Articles

  Home arrow Database Articles arrow Page 4 - PEAR::SQLite: The Lightweight Alternat...
DATABASE ARTICLES

PEAR::SQLite: The Lightweight Alternative
By: bluephoenix
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2004-02-22

    Table of Contents:
  • PEAR::SQLite: The Lightweight Alternative
  • Installing PEAR::SQLite
  • Connecting to a Database
  • Queries
  • Composite Code
  • Unsupported SQL Commands

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    PEAR::SQLite: The Lightweight Alternative - Queries


    (Page 4 of 6 )

    The query method is used to pass SQL queries to the database. Like MySQL, the queries can be used to create and delete tables and to insert, select and update data.

    <?php
    $query 
    "INSERT INTO guestbook (fname, lname, email, comments) VALUES ('John', 'Smith', 'jsmith@example.org', 'This is a cool web site... Keep up the great work!')";
    $result $db-&gt;query();
    ?>

    The fetchRow method can be used to retrieve the results from a SELECT query. It's use is identical to that of PHP's mysql_fetch_row.

    <?php
    $query 
    "SELECT * FROM guestbook";
    $result $db-&gt;query($query);
    while (list(
    $fname$lname$email$comment) = $db-&gt;fetchRow($result)) {
       echo 
    "&lt;p&gt;&lt;a href=\"mailto:$email\"&gt;$fname $lname&lt;/a&gt; said:&lt;br /&gt;";
       echo 
    nl2br(htmlspecialchars(stripslashes($comment))) . "&lt;/p&gt;";
    }
    ?>

    More Database Articles Articles
    More By bluephoenix

    blog comments powered by Disqus

    DATABASE ARTICLES ARTICLES

    - Completing a Book Inventory Management System
    - Uploading Images for a Book Inventory Manage...
    - Finishing the Add Book Story for a Book Inve...
    - Integration Testing for a Book Inventory Man...
    - User Stories for a Book Inventory Management...
    - Unit Testing a Book Inventory Management Sys...
    - Testing a Book Inventory Management System
    - Implementing Models for a Book Inventory Man...
    - Book Inventory Application: Publishers and B...
    - Handling Publishers in a Book Inventory Mana...
    - Publisher Administration for Book Inventory ...
    - Book Inventory Management
    - Using the SQL Reference Manual
    - Using Oracle SQL Developer with SQL Statemen...
    - Fixing Errors with Oracle SQL Developer


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 11 - Follow our Sitemap