i have written the query below to check if record in the database record matches the condition below. I’m sure there’s arow that matches this condition, but the problem is that any set of combination returns the “Record Exists” line
$query = mysql_query("SELECT * FROM result_upload
WHERE course_code = '$course_code'
WHERE session = $session'
WHERE semester_name = $semester_ name'
WHERE level = $level'") or die
(mysql_error());
$duplicates = mysql_num_rows($query);
if ($duplicates = 1)
{
echo "Record Exists";
} else
{
echo "No Record";
}
Thanks in advance.
First of all you are having more than one WHERE clause in you query, you may replace all the WHERE statements after the initial WHERE with AND.
Then use:
($duplictes == 1)
Hope this helps!?