Hello,
Im a noob when it comes to php, and Im trying to figure out how to work out a code that will allow me to filter out an array.
Basically, I have a system to assign offers to my clients and I have a page that is used to assign offers. Once all offers are assigned to a client, I dont want the form to be displayed anymore, but i cant get it work. here is the code:
[PHP]$html .= "<div style='background-image:url(images/gradientdiv.gif); height:26px;'>$row[firstname] $row[lastname](<a href=\"javascript:showDiv('div$member_id');\" style='color:blue;'>Assign Offers</a>)</div> <div id='div$member_id' style='display:none; background-color:#FFFFD9;'>"; $sql_select_offers = "select o.offer_id, o.offer_name from offers o where not exists (select * from members_offers inner join offers on members_offers.offer_id = offers.offer_id where members_offers.member_id = $member_id and o.offer_id = offers.offer_id)"; $result_set_offers = mysql_query($sql_select_offers); $html .= '<form action="assign_offers.php">Check to Assign:<br />'; $html .= "<input type='hidden' name='member_id' value='$member_id' />"; while($row = mysql_fetch_array($result_set_offers)) { $html .= "<input type='checkbox' name='$row[offer_id]' value='$row[offer_id]' />$row[offer_name]<br />"; } $html .= "<input type='submit' value='Save' /></form></div>"; }[/PHP]
The code works fine, but it retrieves all users from the DB, and even those that have all offers already assigned to them, so basically I end up having a <div> tag with only "check to assign" and the save button in it. How can I hide those records that have offers all assigned already?
Thanks a bunch!!!