Organizational Research By

Surprising Reserch Topic

Question:check whether data present in row of database with product key

I have problem with code. It works if data in row of Database is present. But if data is not present then also it gives error message.

This is code:

   $namecheck = mysql_query("SELECT pkey FROM license_key WHERE pkey ='$userEnteredProductKey'");
      if(is_resource($namecheck) && mysql_num_rows($namecheck) > 0 ){
            $sql_result = mysql_fetch_assoc($namecheck);
            echo $userEnteredProductKey . " already registered . use another key";

Please correct me if i go wrong.

asked Sep 13, 2013 in Java Interview Questions by rajesh
edited Sep 12, 2013
0 votes

Related Hot Questions

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.