Re: Mysql Insert/Update Problem

From: Date: Thu, 08 Jan 2004 00:52:35 +0000
Subject: Re: Mysql Insert/Update Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-174026@lists.php.net to get a copy of this message
Haseeb Iqbal wrote:
here is what i am trying to do.i have a PHP CLI script that will open a dbx file extract records from the dbf file one by one check is the record is already on the linux server (mysql database). if the record is already on the linux server then it will update the mysql database on the linux server. but if the record is not in the mysq database running on linux then it will insert the record. the script is running on win2k server.
Is this a one time thing that you need to do or is it continuous? If it's a one time thing, why not just dump one database and import it into the other? If continuous, why not enable replication? You could also use the REPLACE() query, which will UPDATE if the row exists and INSERT if it doesn't. Also, if you remove your indexes while you INSERT a bunch of data and then rebuild them afterwards, it'll be faster. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#174026) next »