science-ation/db/db.update.81.php
dave 1dad6505eb - Select the first contact for each sponsor as the primary
- Prevent the user from setting zero, or more than one, primary contact.
- Add a primary column to the contacts table, so they can see the automatic
  set/unset operations on the primary contact.
2007-12-13 21:50:31 +00:00

12 lines
291 B
PHP

<?
function db_update_81_post()
{
$q = mysql_query("SELECT DISTINCT award_sponsors_id FROM award_contacts");
while($i = mysql_fetch_object($q)) {
$asid = $i->award_sponsors_id;
mysql_query("UPDATE award_contacts SET `primary`='yes' WHERE award_sponsors_id='$asid' LIMIT 1");
}
}
?>