Hi I have a database of names and numbers and when I upload new names and numbers I want to check via the phone number - that that person isn't already in the database. I use the following query:
$dupQuery="SELECT FROM mytable WHERE phoneNum = '$Phone' ";
if( ($result = mysql_query($dupQuery,$conn)) ){
echo("record ".($fileRowCount+1) ." is a duplicate with ". $result ."....<br>");
}
else{
echo(die("SELECT ERROR: " .mysql_error()));
}
where $phone was retrieved from an array using fgetcsv().
however I keep getting the error: [pre]
You have an error in your SQL syntax; check the manual...for the right syntax to use near 'FROM mytable WHERE phoneNum = 'HomePhone'' at line 1[/pre]
I took out the first part of the message because I'm sure most of you are familiar with it and to save space.
'HomePhone' is the first entry in the database so I understand why that's in the error message. However I'm not sure what I'm doing wrong and why I can't retrieve the value in the table.
Please help 🙁