我有问题。我想插入一个下拉项目,然后在下次无法在下拉菜单中显示该项目。运作良好。现在,我想在插入所有下拉菜单项后,然后显示此消息“所有用户已分配”。我正在尝试,但是我的代码无法正常工作。我该怎么办?
谢谢!
<?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>  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
}
?>