Created
July 4, 2016 09:47
-
-
Save avinashseth/a185bd2f1e9dc2a6b5c029dcd8f7f6e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function is_unique | |
| ( | |
| $db = null | |
| ) | |
| { | |
| // this statement means please count, and tell me how many students have rollnumber = 1022 | |
| $count = $db->count("students",["student_rollnumber"=>"1022"]); | |
| // if count == 0 means no student has rollnumber 1022 | |
| if($count == 0) { | |
| return true; // yes it is unique | |
| } else { | |
| // else means there is 1 or more student who have rollnumber 1022 which means it is not unique | |
| return false; // no it is not unique | |
| } | |
| } | |
| // using library medoo for mysql | |
| // website http://medoo.in/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment