Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword or section
Like this
12Activity

Table Of Contents

0 of .
Results for:
No results containing your search query
P. 1
SQLITE Php Pdo Referance

SQLITE Php Pdo Referance

Ratings: (0)|Views: 11,555|Likes:
Published by jwzumwalt
A comprehensive programmer's reference for using SqLite using PHP PDO (object) codeing. Includes simple database examples. Most topics include a short 5 to 10 line program that demonstrates a concept.or topic.
A comprehensive programmer's reference for using SqLite using PHP PDO (object) codeing. Includes simple database examples. Most topics include a short 5 to 10 line program that demonstrates a concept.or topic.

More info:

Published by: jwzumwalt on Feb 08, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

08/16/2013

pdf

text

original

 
SQLiteUsingPHP & PDO
 
Reference
 
by Jan Zumwalt - NeatInfo.com
 
NeatInfo.com - by Jan Zumwalt Copyright © 2005-2012 February 10, 2012Pg 2 of 76
Table of Contents
Section - 1 Introduction
...........................................................................................................................................5
 
About This Reference.........................................................................................................................................................................................5
 
What is PDO........................................................................................................................................................................................................5
 
SQLite2 VS SQLite3.............................................................................................................................................................................................5
 
What database does PDO support?..................................................................................................................................................................6
 
Setting up a development system.....................................................................................................................................................................6
 
XAMPP config files..............................................................................................................................................................................................6
 
Database managers............................................................................................................................................................................................7
 
Do I have PDO on my computer?......................................................................................................................................................................8
 
Good Programming Syntax................................................................................................................................................................................9
 
Single Row Data............................................................................................................................................................................................9
 
Multiple Row Data........................................................................................................................................................................................9
 
Section - 2 Simple Database Example................................................................................................................................11
 
Connect and error handling.............................................................................................................................................................................11
 
Create and Insert Into Database.....................................................................................................................................................................11
 
View and Search Data......................................................................................................................................................................................12
 
Update Data......................................................................................................................................................................................................13
 
Delete Data.......................................................................................................................................................................................................14
 
Section - 3 Database (Add-Copy-Delete-Rename).............................................................................................................15
 
Add Database....................................................................................................................................................................................................15
 
Copy Database..................................................................................................................................................................................................15
 
Delete Database...............................................................................................................................................................................................16
 
Rename Database............................................................................................................................................................................................16
 
Database Descriptions.....................................................................................................................................................................................17
 
Master Database..............................................................................................................................................................................................17
 
Command Line.............................................................................................................................................................................................17 
 
Section - 4 Table (Add-Copy-Delete-Rename)...................................................................................................................19
 
Add Table..........................................................................................................................................................................................................19
 
Copy Table With Data......................................................................................................................................................................................20
 
Copy Table Structure........................................................................................................................................................................................21
 
Delete Table......................................................................................................................................................................................................22
 
Rename Table...................................................................................................................................................................................................22
 
View Table Structures......................................................................................................................................................................................22
 
Table Description..............................................................................................................................................................................................23
 
Section - 5 Row (Add-Copy-Delete-Rename).....................................................................................................................25
 
Add Row (insert)...............................................................................................................................................................................................25
 
Copy Row..........................................................................................................................................................................................................25
 
Delete All Rows.................................................................................................................................................................................................25
 
Delete Row(s) Matching Condition.................................................................................................................................................................25
 
Count Rows.......................................................................................................................................................................................................26
 
Index Description..............................................................................................................................................................................................27
 
Section - 6 Column (Add-Copy-Delete-Rename)................................................................................................................28
 
Add Column......................................................................................................................................................................................................28
 
Copy Column and data.....................................................................................................................................................................................28
 
Delete Column..................................................................................................................................................................................................28
 
Rename Column...............................................................................................................................................................................................28
 
Count Columns.................................................................................................................................................................................................29
 
Section - 7 Show and Search Data.....................................................................................................................................30
 
Simple Select Syntax.........................................................................................................................................................................................30
 
 
NeatInfo.com - by Jan Zumwalt Copyright © 2005-2012 February 10, 2012Pg 3 of 76
The four fetch types.........................................................................................................................................................................................30
 
WHERE.........................................................................................................................................................................................................31
 
LIKE...............................................................................................................................................................................................................31
 
 AND..............................................................................................................................................................................................................32
 
OR.................................................................................................................................................................................................................32
 
Advanced Select Syntax...................................................................................................................................................................................32
 
LIMIT............................................................................................................................................................................................................32
 
ORDER BY.....................................................................................................................................................................................................33
 
GROUP BY....................................................................................................................................................................................................33
 
HAVING........................................................................................................................................................................................................33
 
Section - 8 Views................................................................................................................................................................35
 
Section - 9 Triggers............................................................................................................................................................36
 
Insert Row Timestamp.....................................................................................................................................................................................36
 
Logging All Inserts, Updates, and Deletes......................................................................................................................................................36
 
Section - 10 Transactions...................................................................................................................................................38
 
Section - 11 Joins...............................................................................................................................................................39
 
CROSS JOIN.......................................................................................................................................................................................................40
 
INNER JOIN........................................................................................................................................................................................................41
 
LEFT OUTER JOIN..............................................................................................................................................................................................41
 
RIGHT OUTER JOIN and FULL OUTER JOIN.....................................................................................................................................................42
 
UNION...............................................................................................................................................................................................................42
 
Section - 12 Date And Time Functions...............................................................................................................................43
 
Function Format...............................................................................................................................................................................................43
 
Modifiers...........................................................................................................................................................................................................44
 
Examples...........................................................................................................................................................................................................45
 
Save current or future date........................................................................................................................................................................45
 
Less than time span.....................................................................................................................................................................................46
 
Date equal to time span.............................................................................................................................................................................46
 
Caveats And Bugs.............................................................................................................................................................................................46
 
Section - 13 Saving and Displaying Images.........................................................................................................................47
 
Test Image.........................................................................................................................................................................................................47
 
Saving an Image................................................................................................................................................................................................48
 
Display an Image...............................................................................................................................................................................................49
 
Section - 14 Crypt, Hash, etc..............................................................................................................................................52
 
Function Syntax................................................................................................................................................................................................52
 
File IO.................................................................................................................................................................................................................52
 
Section - 15 Tools & Utilities..............................................................................................................................................53
 
Text Scrubbing..................................................................................................................................................................................................53
 
Appendix - A Error Handling..............................................................................................................................................54
 
Error Codes.......................................................................................................................................................................................................54
 
1) If you copied code from a page of this reference...............................................................................................................................54
 
2) Some SQLite versions have incompatibilities......................................................................................................................................54
 
3) "Invalid resource" error........................................................................................................................................................................55
 
4) Sensitivity to white space.....................................................................................................................................................................55
 
5) “unable to open file”.............................................................................................................................................................................55
 
6) “SQLITE_CORRUPT error”.....................................................................................................................................................................55
 
7) “WHERE Clause error”..........................................................................................................................................................................55
 
8) Unexpected return value, i.e. “Array”.................................................................................................................................................55
 
9) SYNTAX ERROR, Unexpected “End”…..................................................................................................................................................56
 
10) “unexpected T_VARIABLE”.................................................................................................................................................................56
 

Activity (12)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Stofigra liked this
Rrhh Est liked this
Warren Downs liked this
Warren Downs liked this
Warren Downs liked this
Warren Downs liked this
Warren Downs liked this
Warren Downs liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->