SQLite Edit for PHP
- On this page:
- Introduction
- Features
- Example
- Download
- Other pages:
- About
- API reference
- Search functionality
- Data editing functionality
- How to use file uploads
- Custom events that are available
- License
- FAQs
- Changelog
- GitHub repository
Introduction
SQLite Edit for PHP is a Free and Open Source web-based admin tool for making interfaces to your SQLite database tables. It's not a full database admin tool however. You cannot use it to add, modify or delete tables, views etc. You wouldn't give such a tool to your users, allowing them to destroy your database! It's a tool that allows the addition, editing and deletion of data in existing tables. Adding, editing and deletion can all be enabled or disabled so you can turn them all off and just allow viewing the data if you wish.
It can be easily integrated into your pages - as you can see from the example below. It's just a single library file which makes it simple to setup and go.
What about the phpSQLiteAdmin application?
SQLite Edit for PHP cannot be used for database administration tasks. It has no facilities to add, edit or delete tables, indexes or views etc. Read more in the FAQs here.
Features
SQLite Edit for PHP is a flexible piece of software that can handle many use cases.
| ✓ | Define your own SQL queries instead of the defaults for selecting, inserting, deleting and updating rows. For example, you might want to exclude rows that have a "deleted" flag set. |
| ✓ | Editing of rows with various form controls including simple text inputs, file upload inputs, select dropdowns, radio buttons, checkboxes and most (if not all) of the newer HTML5 inputs (for example slider bars). Custom save URLs can be given to handle the saving of the updated data yourself if required. |
| ✓ | The file upload support allows you to upload files from your computer and then either store them in the database or on the filesystem. |
| ✓ | Custom column names instead of the database column names if preferred. |
| ✓ | Custom column widths. |
| ✓ | Different callback functions can be given for each column allowing you to customise the output to your needs (for example formatting a date column to be more human readable). |
| ✓ | Events are fired for add/edit/delete actions allowing you to run your own functions when such an event occurs. |
| ✓ | Columns can be fully escaped or you can allow HTML in columns (for example, to show images or text formatting). |
| ✓ | Customisable number of rows shown at once with paging controls shown at the top-right of the grid (as you can see from the example below). |
| ✓ | A quick and comprehensive search function using the SQLite GLOB syntax (which is similar to regular expression syntax and allows for wildcard searches). |
| ✓ | The results can be ordered by the user by clicking the column headers. Columns can be included or excluded from ordering or you can disable ordering completely. Ordering can be case sensitive or not as you see fit. |
| ✓ | The grid can be fully styled using CSS. This CSS can be specified within the configuration if you wish or you can just put it in your own CSS file. |
| ✓ | HTML buttons (or any HTML) can be placed underneath the grid or on the right of each row. For example, you could have a select dropdown on the right of each row that contains various actions that you want to provide to your users. |
| ✓ | Checkboxes or radio buttons (or neither!) can be placed on the left side of each row. |
Example
And here's the source-code that produces the editor above.
<?php
$editor = new SQLiteEdit([
'filename' => 'examples/sqliteedit.db',
'table' => 'accounts',
'sql_select' => "SELECT id,
username,
created,
forename,
surname
FROM accounts
WHERE {where}
{order}",
'sql_insert' => false,
'sql_delete' => false,
'paging_perpage' => 7,
'columns_names' => [
'id' => 'ID',
'username' => 'Username',
'created' => 'Created',
'forename' => 'Forename',
'surname' => 'Surname'
],
'style' => [
'div.editor table {line-height: 25px;}',
'div.editor table th {text-align: center;}',
'div.editor table tbody tr:hover {background-color: #eee;}',
'div.editor table {width: 100% !important;}'
],
'actions' => [
'<small><i>(add/edit/delete are disabled on this demo)</i></small>'
],
'search_callback' =>function ($obj, $columns, &$terms)
{
foreach ($terms as &$t) {
if ( in_array($t, ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december','jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'])) {
$t = date('-m-', strtotime($t));
}
}
}
]);
$editor->draw();
?>
Download
This is the latest zip file download that contains the PHP file (it's just a single file) and the example pages. Extract this zip file to a directory on to your (PHP enabled) web server and all of the examples should run without any further modification or configuration.
Just want the source code?
If you just want the source code - get that using the link below. It's just a single file so you can copy it into your source tree and run it straight away. For the examples of how to use it you'll need the full source archive linked above.
 
Last updated: 11th October 2026