I have a small script to upload data to mysql database from a csv file and I want to check the list of values that are inside of the csv file.
CSV File:
Please check mysql exists subqueries.
Exists and Not Exists subqueries
As others have said, you should really use PDO. But, to answer your question, mysql_num_rows is your solution.
$query = mysql_query("SELECT * FROM products WHERE code='$line_of_data[0]' AND alert_quantity = '$line_of_data[1]'") or die(mysql_error());
if (mysql_num_rows($query))
// Data is already in database
else
// Data not in database