lundi 30 janvier 2017

Empty result SQL Query

Else if is not showing the output.. what seems to be the problem here?

<?php 
$wp_user_search=$ wpdb->get_results("SELECT * FROM wp_hdoi_mentor where status='active' ORDER BY mentor_id");

foreach ( $wp_user_search as $user_info ) {
    $user_id=$user_info->user_id;
    $role=$user_info->user_role;

    if( $role=='Mentor'){

        echo '<tr><td class="match">' .$user_info->mentor_id. '</td>';
        echo '<td class="match">'. "<a href='mentor.php?id=$user_id'>" .$user_info->first_name.'&nbsp;'.$user_info->last_name.'</a>'.'</td>';
        echo '<td class="match">' .$user_info->email_address.'</td>';
        echo '<td class="match">' .$role.'</td>';
    }

    if(!empty($role)) {
        echo 'no record found'; 
    }
} ?>

Aucun commentaire:

Enregistrer un commentaire