Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How can I export raw SQLite databases using PHP?

Posted on 2009-05-20
2
341 Views
Last Modified: 2013-12-12
Hello,

I need to be able to export a raw SQLite database into a file using PHP. This is so that I can download this file from the server and use it with other applications.

I'm experienced in PHP and SQL, I know how to create and manage databases, but I can't figure out how to export in the raw database format. It always seems to want to export as SQL statements, which is not what I want, I need the raw format.

Thanks,
Steve
0
Comment
Question by:flashjordan
  • 2
2 Comments
 
LVL 19

Accepted Solution

by:
NerdsOfTech earned 500 total points
ID: 24436771
use: sqlite_factory()
http://us2.php.net/manual/en/function.sqlite-factory.php
<?php
$dbhandle = sqlite_factory('sqlitedb');
$dbhandle->query('SELECT user_id, username FROM users');
 
/* functionally equivalent to: */
 
$dbhandle = new SQLiteDatabase('sqlitedb');
$dbhandle->query('SELECT user_id, username FROM users');
 
?>

Open in new window

0
 
LVL 19

Expert Comment

by:NerdsOfTech
ID: 24436779
A SQLiteDatabase object is returned rather than a resource :)
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question