SQLite Tutorial in PHP
SQLite Tutorial in PHP
SQLite is an SQL database manager used locally or on a website, and compatible
in particularly with PHP.
Summary
Installing SQLite and creating a database
.
Installing SQLite. Verifying the installation by creating a base.
Creating and using a SQLite table
.
Creating a table. Deleting a table. Adding a record. Reading a record.
How to find and update a post
.
Filling a database. Dump of the whole base. Finding a record by ID. Searching a post. Updating a post.
Download
The complete source code of the scripts
in a ZIP archive.
More
SQLite and multi-users. How to treat concurrency issue with SQLite
.
Ïà¹ØÎĵµ£º
ÏÂÃæÕâһС¶Î“ÁÓÖÊ”µÄPHP´úÂëÊÇÒ»µÀ¼ò»¯Á˵IJâÊÔÌâ¡£ÕâÖÖÎÊÌâ¾ÍÏñÔÚÎÊ£ºÄã¸ÃÔõÑùÓÅ»¯Õâ¶Î´úÂ룿
<?
echo(”<p>Search results for query: ” .
$_GET['query'] . “.</p>”);
?>
¡¡¡¡Õâ¶Î´úÂëµÄÖ÷ÒªÎÊÌâÔÚÓÚËü°ÑÓû§Ìá½»µÄÊý¾ÝÖ±½ÓÏÔʾµ½ ......
function get_web_page( $url )
{
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page ·µ»ØÍøÒ³
CURLOPT_HEADER => false, // ²»·µ»ØÍ·ÐÅÏ¢
CURLOPT_FOLLOWLOCATION => true, ......
Õâ¶Îʱ¼äÔÚ¿´¡¶PHPºÍMySQL Web¿ª·¢¡·Ò»Êé¿´µ½str_replace½²½â£¬Ò»¶ÎСÌáʾдµ½£º¿ÉÒÔΪstr_replaceµÄÈý¸ö¶¼Ê¹ÓÃÊý×é´«È룬µ«½²½â±È½Ï¼òµ¥£¬ÓÚÊǾö¶¨×Ô¼ºµÄÊÔÑéһϸú¯ÊýÔÚ¸÷¸ö²ÎÊý´«ÈëÊý×éʱµÄÖ´Ðнá¹û¡£
º¯ÊýÔÐÍ£ºmixed str_replace(mixed needle,mixed new_needle,mixed haystack[,int &count]);
needle£ ......
¡¡ 1¡¢ÓÃPHP´òÓ¡³öÇ°Ò»ÌìµÄʱ¼ä¸ñʽÊÇ2006-5-10 22:21:21(2·Ö)
¡¡¡¡2¡¢echo(),print(),print_r()µÄÇø±ð(3·Ö)
¡¡¡¡3¡¢Äܹ»Ê¹HTMLºÍPHP·ÖÀ뿪ʹÓõÄÄ£°å(1·Ö)
¡¡¡¡4¡¢Ê¹ÓÃÄÄЩ¹¤¾ß½øÐа汾¿ØÖÆ?(1·Ö)
¡¡¡¡5¡¢ÈçºÎʵÏÖ×Ö·û´®·×ª?(3·Ö)
¡¡¡¡--------------------------------------------------------------- ......
<?php
// open database connection
@ $db = new mysqli($host, $user, $password, $database_name);
if (mysql_connect_error())
{
echo '';
exit;
}
// query
$result = $db->query($sql);
$num_results = $db->num_rows;
// data
$row = $result->fetch_assoc(); // row is array, $row['id' ......