Ok, I created a script that reads information from a .dat file and then dumps it into the correct fields in my database. I would like to add to the .dat file and be able to run an "update" script that checks the exisiting data table and then adds the lines of data that do not already exist.
Here is part of my original script that has created the table and is supposed to add the data:
$datFile = "../xxxxxx/xxxxxx.dat";
$fh = fopen($datFile, "r") or die( "unable to open $datFile");
while(!feof($fh))
{
$line = fgets($fh,1024);
if (preg_match('#^\[(.+)\s(.+)\]\s(.+)\s\"(.+)\"\s\"(.+)\"\s(.+)#', $line, $matches)) {
list(, $date, $time, $guid, $nick, $ip, $viol) = $matches;
$sql = "INSERT INTO xxxxxx (date, time, guid, nick, ip, viol) VALUES ('$date', '$time', '$guid', '$nick', '$ip', '$viol')";
mysql_query($sql) or die(mysql_error());
}
}
I would like to be able to modify this script to where it checks the exiting table for data that already is there so i do not get multiple inserst of the same data.
Any help will be appreciated!