I am trying to find a match in two different columns using input from two different form fields in a PHP form. I am referencing the two string variables that are input into the form in my mysql code, but it is returning an error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MATCH (abcdef) AGAINST name' at line 1
I have tried a few variations of the syntax, but with no success.
$name = mysql_real_escape_string($_POST['studentname']);
$num = mysql_real_escape_string($_POST['studentnum']);
$qw = "SELECT name FROM students MATCH ($name) AGAINST name";
$qw1 = "SELECT studentnum FROM students MATCH ($num) AGAINST studentnum";
$namematch = mysql_query($qw) or die(mysql_error());
$nummatch = mysql_query($qw1) or die(mysql_error());
if (($namematch || $nummatch) == FALSE) {
die('Name or student number do not match those on record');
}