paulman888888 Posted October 31, 2008 Share Posted October 31, 2008 Hi everyone, I installed a application that uses SQlite3 and no other. What i want to do is to Keep Mysql database the same as the SQlite. Why? Because i understand Mysql syntax. I don't no how to copy SQlite3 database to Mysql? I think i would 'TRUNCATE TABLE' the table then some sort of loop that takes data from SQlite and INSERTS it into The MySQL. Please Help Thankyou Paul Quote Link to comment Share on other sites More sharing options...
feidakila Posted October 31, 2008 Share Posted October 31, 2008 select * from sqlite_db_table_name query the dbase, and make a loop to insert those registers into the new database, just use the fields that you need from the source table, something like while ($register=sqlite_fetch_array($sqlite_query_result)) { $query2 = "INSERT INTO mysql_table (field_name1, field_name2,...) VALUES (field_value1, field_value2,....)"; $query_result2 = mysql_query($query2); } but you should check to make the right connections with both databases, in order to query propperly Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted October 31, 2008 Author Share Posted October 31, 2008 I made my connection to my MySQL database, but how do i connect to SQLite? I have no knowlegde what so ever SQLite. Is there a site i can learn the basics from? Thankyou Paul Quote Link to comment Share on other sites More sharing options...
feidakila Posted October 31, 2008 Share Posted October 31, 2008 manual page is great, search for the function you need http://php.net/manual/en/book.sqlite.php Quote Link to comment Share on other sites More sharing options...
feidakila Posted October 31, 2008 Share Posted October 31, 2008 # sqlite_open — Opens a SQLite database and create the database if it does not exist # sqlite_popen — Opens a persistent handle to an SQLite database and create the database if it does not exist Quote Link to comment Share on other sites More sharing options...
paulman888888 Posted October 31, 2008 Author Share Posted October 31, 2008 Am using SQLite3. I have read abit of that as well but i cant et my head around it can someone make a simple example please with lots of comments. I find it easyer to learn via examples. Thankyou all Paul Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.