|  | Posted by Geoff Berrow on 06/18/05 13:37 
I noticed that Message-ID: <42b3f2ec$0$38037$5a6aecb4@news.aaisp.net.uk>from Mike MacSween contained the following:
 
 >Thanks. I think you may have misunderstood. I want to get data FROM the
 >Access database and INTO the MySQL database.
 
 The way I have done this in the past is to export the access database
 then update the MySql database like so:
 
 # Connect to the database
 mysql_connect($sql_db,$sql_id,$sql_pwd);
 
 # Delete the current content of the table
 $result = mysql_db_query($sql_db,"DELETE FROM $table") or die ("Invalid
 DELETE query");
 
 # Optimize the current table (recover empty space)
 $result = mysql_db_query($sql_db,"OPTIMIZE TABLE $table") or die
 ("Invalid OPTIMIZE query");
 
 # Load local comma separated, fields enclosed by quotes text database -
 File has to be in the same directory of this file
 $result = mysql_db_query($sql_db,"LOAD DATA LOCAL INFILE
 'exporteddata.txt' INTO TABLE $table FIELDS TERMINATED BY ';'  ENCLOSED
 BY ''") or die ("Invalid DATA LOAD query");
 
 # Get how many records are present in the table now
 $result = mysql_db_query($sql_db,"SELECT * from $table") or die
 ("Invalid SELECT query");
 $rows_count = mysql_num_rows($result);
 
 echo "Records: $rows_count"; mysql_free_result($result);
 --
 Geoff Berrow (put thecat out to email)
 It's only Usenet, no one dies.
 My opinions, not the committee's, mine.
 Simple RFDs http://www.ckdog.co.uk/rfdmaker/
  Navigation: [Reply to this message] |