Xs142 Posted September 30, 2009 Share Posted September 30, 2009 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 More sharing options...
justsomeguy Posted September 30, 2009 Share Posted September 30, 2009 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 More sharing options...
Xs142 Posted September 30, 2009 Author Share Posted September 30, 2009 Well the file in itself is a SQLite3 database, I just want certain tables transfered from the file into my database. Link to comment Share on other sites More sharing options...
justsomeguy Posted September 30, 2009 Share Posted September 30, 2009 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. Link to comment Share on other sites More sharing options...
Xs142 Posted September 30, 2009 Author Share Posted September 30, 2009 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... Link to comment Share on other sites More sharing options...
justsomeguy Posted September 30, 2009 Share Posted September 30, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.