Jump to content

Importing Lines From .db To Mysql Via Php Form?


Xs142
 Share

Recommended Posts

Well the basics are simple,the rest, I'm lost.Not much of a coder myself, but willing to spend 8-16 hours per day doing trial-and-error work until I get it right, I do consider myself quite handy with my coding.So, what I need/want is to create a form, for users to use, (Only members prefered)that let's them upload a .db file (SQLite 3)The server then proceeds to extract certain values from the file (specified beforehand) and adds them to a pre-set table in my MySQL database..How on earth do I pull this one off?

Link to comment
Share on other sites

The details are a little vague, but you'll need an upload form to upload the file, then once the file is uploaded you can use file_get_contents to get the contents of the file. You can probably use regular expressions to find the values you're looking for in the data.http://www.php.net/manual/en/features.file-upload.phphttp://www.php.net/manual/en/function.file-get-contents.phphttp://www.php.net/manual/en/function.preg-match.php

Link to comment
Share on other sites

You'll need to open up the file and inspect it to figure out how to identify the parts you need. I don't know what format SQLite3 stores things in.
Well, I need a SQLite manager to even view it and it looks the same as my MySQL database..Opening it in any notepad just displays "SQLite format 3" and a whole lot of garble... Edited by Xs142
Link to comment
Share on other sites

It sounds like it's in a binary format. If you want to use PHP to accept the file upload, get the data, and add it to another database you're going to need to know how to use that binary format. You may need to look up the specification for SQLite to figure out how it stores data and how you can parse it.An easier solution would be to have PHP use SQLite to open it, and then use it as a regular database. You would select the records from it, and insert the data into your other database. There should be a PHP driver for SQLite:http://www.php.net/manual/en/book.sqlite.php

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...