I have a big MySQL database and I'm extracting the important bits into a smaller MySQL database. The values in the big database are constantly changing. The smaller database should also be changing dynamically.
I am able to populate the smaller database only when it's empty, using this code:
$SQL_INSERT="INSERT LOW_PRIORITY IGNORE INTO oddsnavi_baby.calc (one , two, three)
VALUES ('$one', '$two' , '$three')";
mysql_db_query($database_baby, $SQL_INSERT) or die("Failed Query of " . $SQL_INSERT);
I'd like the values which are changed to be updated. For example, if $three is different than the existing value in 'three' in the small database, then 'three' is the only updated value in the row. How to do that?
EDIT: I'm getting an error with the following code. What's wrong with my syntax?
$SQL_INSERT="INSERT LOW_PRIORITY IGNORE INTO oddsnavi_baby.calc (one , two, three)
VALUES ('$one', '$two' , '$three')
ON DUPLICATE KEY UPDATE oddsnavi_baby.calc SET two = '$two' , three = '$three'
WHERE one = '$one'";