moisesbr Posted August 18, 2013 Share Posted August 18, 2013 Hi I have a database where some students don't have their Identity_number stored , but all students have a code. I am trying to implement a search in this database with some degree of safety. In first html page, both fields are mandatory (because everbody has an Identity_number to type ) $result = mysql_query("SELECT * FROM certificado WHERE Identity_number= '$cpf'") or die (mysql_error()); If found Identity_number, compare certificado.code with $code and show (html result - a already have) if match.However if Identity_number is not found, then search only by code. ( because nobody will guess student does not have Identity_number in database .) Is it easy to do such a code ? I need help at least with $result mysql lines. Moises Link to comment https://forums.phpfreaks.com/topic/281313-safety-conditional-search-in-a-students-database/ Share on other sites More sharing options...
Barand Posted August 18, 2013 Share Posted August 18, 2013 How about WHERE (indentity_number = $x) OR (student_code = '$y') Link to comment https://forums.phpfreaks.com/topic/281313-safety-conditional-search-in-a-students-database/#findComment-1445681 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.