Return true if data is empty function.
-
I am trying to create a function that will draw data from the database and check if the row is empty. If the function is empty, continue.. If !empty, do not display anything. I know there is many ways to do this. But I am trying to create less code and structure it a little neater.
Here is my example.function check_if_blocked(){ global $wpdb; $results = $wpdb->get_results("SELECT * FROM 'mytable' WHERE user = $user"); if(empty($resuts)){ $var = false; } else { $var = true; } return $var } function msg_form(){ if(check_if_blocked()){ // do stuff if user is not blocked // If user is blocked, do not display code } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Return true if data is empty function.’ is closed to new replies.