You are here: Re: Local Access database to shared PHP/MySql hosting export « PHP Programming Language « IT news, forums, messages
Re: Local Access database to shared PHP/MySql hosting export

Posted by Mike MacSween on 06/18/05 14:46

Thanks Geoff. How would you get the txt file up to the server? FTP?

I would like to avoid having FTP passwords embedded in the application if
poss.

Mike

"Geoff Berrow" <blthecat@ckdog.co.uk> wrote in message
news:jtt7b1lsca8n8rd0tuq3e0oovheupapkpr@4ax.com...
>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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация