mercredi 18 juillet 2018

Message show when all dropdown items have inserted

I have a problem. I want when inserted a dropdown item, then this item not able to show in a drop-down in next time. It's working well. Now I want when every dropdown item has inserted, then need to show this message 'All users have assigned'. I am trying but its my code is not working. How can I do that?

Thanks!

<?php
$user_info2 = $wpdb->get_results( "SELECT * FROM user_contact_info WHERE user_company = $company_id" );

    if (empty($user_info2)) 
    {
        echo "<h2>All users have assigned</h2>";
    }
    else
    {
        ?>
        <select type="text" name="ap_user" id="county" style="font-family: 'FontAwesome', Arial;" class="form-control" required >
            <option disabled selected value> &#xf00c Select User</option>
            <?php
            foreach ($user_info2 as $user) 
            { 
                $assigns = $wpdb->get_results( "SELECT * from user_searches WHERE ap_user = $user->id AND ap_company = $company_id AND ap_project = $id " );
                // foreach ($assigns as $assigned) 
                // {
                    if(!$assigns)
                    {
                        echo '<option value="'.$user->id.'" >'.$user->user_name.'</option>';
                    }
                // }
            }
            ?>
        </select>   
        <?php
    }
?>  

Aucun commentaire:

Enregistrer un commentaire