Import into mysql


#1

How do I import data into mysql and tell mysql to only add new records or update just the changed records and leave the rest of the data the same.

Here is what I am trying to do. I currently use Telemagic as my database and have been for over 15 years. It is a property management business and I want to export just the properties that are available. I have the export part down. It’s just that when I import into mysql, the existing records do not update with new changes or new data.

It seems that I have to delete all the existing data and import all new records. If I do this, then the links to to pictures will get deleted too. I want those fields/links to stay the same, but only update if other data changes.

Does any of this make sense to anyone out there? I want to continue using Telemagic for my data because I also use it for wordprocessing/merging with hundreds of forms/letters used in the business. I don’t want to start all over and create a whole new database just to have dynamic data for the website.

I am extremely new to mysql, so any suggestions would be very much appreciated. Be kind!!!

Thanks in advance for any help!


#2

Here is an extremely simple database insert code. This is for learning purposes only. If you change this to allow input from a user, make sure to add measures to prevent the user from tampering with your database.

submit.php

[code]

Database Insert Test

Database Insert Test

<?php include ('dbconnect.inc'); $dbh = mysql_connect($host, $username, $password) or die("No access"); mysql_select_db($database); $stmt = ("INSERT INTO dynamicinfo (num, Date, text) VALUES (NULL, '2008/6/19', 'PHP test')"); $sth = mysql_query($stmt); mysql_close ($dbh); ?> [/code]dbconnect.inc

<?php $username='username'; $password='password'; $host='subdomain.domain.com'; $database='mydatabasename'; ?> Double check the date above, I may have the day and month backwards.
Hope this helps,
Silk

My website


#3

If you’re not opposed to using a 3rd party tool, you should check out the Data UpLoader to mySQL on this web site: http://pervasivedatatools.com. You can map data from Telemagic to mySQL, and it allows you to do inserts and updates in the same pass.