Current location: Hot Scripts Forums » Programming Languages » PHP » Convert Access to Mysql


Convert Access to Mysql

Reply
  #11 (permalink)  
Old 04-27-05, 01:17 AM
matiucarr matiucarr is offline
New Member
 
Join Date: Apr 2005
Location: Auckland
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
The line in the code where you "explode" each line from your dump of the table(s) in access uses ";". For CSV use ",".

$cols = explode(',', (str_replace("'", "''", $line)));

This will now convert 's (single quotes) appropriately for use in SQL expressions and then splits each input line along the ,s (commas) giving an array containing the items associated with each record.
Reply With Quote
  #12 (permalink)  
Old 04-27-05, 05:41 AM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
if the code isnt too long i'll manually do it for free, PM me...
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Reply With Quote
  #13 (permalink)  
Old 04-27-05, 06:34 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
Dr.Jamescook, could you post one line of the CSV file?
the seperator is causing the problem..

as for escaping the single quotes, you don't need to do that manualy! simply use addslashes() on the values and when you retraive them from mysql use stripslashes()..

Quote:
I forgot who gave this to me, but whoever you are...thankyou. It saves me alot of time!
that would be me, I guess
http://www.programmingtalk.com/showthread.php?t=15964

you will also find that I replied to you about addslashes().. it could've saved you some good time
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #14 (permalink)  
Old 04-27-05, 09:39 AM
Dr.Jamescook Dr.Jamescook is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
I intende on telling you guys last night but I got it done. I downloaded a fully functional free trial of navicat. This program did it but not without trouble. It would not do the Access file but it converted the Excel file with good success. Thanks a bunch for your help.

Here is one line of the csv file.
1,OT,1,Genesis,1,1,1,In the beginning God created the heaven and the earth.,

There you have it. I would like to still see if it is possible without buying a program (or free trials), so please continue this conversation. I'll be here and I'll help.
Reply With Quote
  #15 (permalink)  
Old 04-28-05, 10:59 AM
moronovich moronovich is offline
Junior Code Guru
 
Join Date: Oct 2004
Posts: 460
Thanks: 0
Thanked 0 Times in 0 Posts
you can also use access2mysql to automatically convert access db to mysql. (just google if you're interested)
__________________
just an ignorant noob with moronic solution...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert SQL Access to MySQL djavet PHP 1 05-07-04 01:40 PM
Access MySQL at another location? mqcarpenter PHP 8 11-21-03 08:28 AM
Is there any way I can link MS Access to a MySql on a remote web server (ISP)? xmxpcom PHP 2 11-12-03 03:33 AM
mysql to access aspuser25 Database 2 09-16-03 11:01 AM
How to convert an Exchel sheet into MySQL DB Ole Nygaard PHP 1 08-27-03 09:10 AM


All times are GMT -5. The time now is 06:40 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.