Check whether MySQL record exists based on 2 parameters
I'm fine checking whether a record exist that matches a sing开发者_JAVA技巧le column:
mysql_query("SELECT * FROM articles WHERE s_id = '$myVar'")
However, I want to see whether there is an exact match for two columns in the database (a_id and s_id), while ignoring the match of the 3rd column.
Any ideas on how to check for a match on two parameters exist?
Thanks so much for taking a look - feel free to ask for any clarifications.
mysql_query("SELECT * FROM articles WHERE s_id = '$myVar' AND a_id= '$myVar2'")
Try:
mysql_query("SELECT * FROM articles WHERE s_id = '$myVar' AND a_id = '$myOtherVar'")
精彩评论