I wish not to insert a record if the record already is in my mysql database
I have a MySQL query that inserts sales data into my database
I run a script that gathers all my sales for the past day/or week
but sometimes I will have a query that will have the same/ duplicate sales information in it and I do not wish to have that query entered into my database, I just want to skip past it
the field 'SalesRecord' is unquie for each sales record, ie 7343, what would be the simplest way to write a sql query to skip past a sales record if the sales record already exists in my database
heres my sql
// NOW ADD THE SALES DATA TO EBAYSALESLISTINGS DATABASE
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
$sql = "INSERT INTO `ebaysaleslistings`(`SalesRecord`, `OrderID`, `Order`, `AmountPaid`, `SalesTaxAmount`, `ExternalTransactionID`, ".
"`ExternalTransactionTime`, `ExternalFeeOrCreditAmount`, `ExternalTransactionPaymentOrRefundAmount`, `ShippingServiceSelected`, `ShippingServiceCost`, `ShippedTime`, ".
"`Name`, `Street1`, `Street2`, `CityName`, `PostalCode`, `StateOrProvince`, `CountryName`, `Phone`, `OrderLineItemID`, `EbayItemID`, ".
"`EbayFees`, `Title`, `QuantityPurchased`, `BuyerEmail`, `TransactionID`, `TransactionPrice`, `Platform`) ".
"VALUES ('$elm_SaleRecordID','$elm_OrderID','$elm_OrderStatus','$AmountPaid','$SalesTaxAmount','$externalTransaction->ExternalTransactionID','$externalTransaction->ExternalTransactionTime','$externalTransaction->FeeOrCreditAmount','$externalTransaction->FeeOrCreditAmount', ".
"'$ShippingServiceSelected->ShippingService','$ShippingServiceSelected->ShippingServiceCost','$order->ShippedTime','$shippingAddress->Name','$shippingAddress->Street1','$shippingAddress->Street2','$shippingAddress->CityName','$shippingAddress->PostalCode', ".
"'$shippingAddress->StateOrProvince','$shippingAddress->CountryName','$shippingAddress->Phone','$transaction->OrderLineItemID','$elm_EbayItemID', ".
"'$elm_EbayFees','$elm_title','$transaction->QuantityPurchased','$elm_email','$transaction->TransactionID','$transaction->TransactionPrice','$transaction->Platform')";
echo "<br><br>" . $sql . "<br><br>";
mysql_select_db('ebaylistingmanager');
$retval = mysql_query( $sql, $conn );