Index: modules/contact/contact.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.admin.inc,v
retrieving revision 1.5
diff -u -p -r1.5 contact.admin.inc
--- modules/contact/contact.admin.inc	2 Jul 2008 20:05:11 -0000	1.5
+++ modules/contact/contact.admin.inc	31 Aug 2008 11:53:58 -0000
@@ -12,7 +12,7 @@
 function contact_admin_categories() {
   $result = db_query('SELECT cid, category, recipients, selected FROM {contact} ORDER BY weight, category');
   $rows = array();
-  while ($category = db_fetch_object($result)) {
+  foreach ($result as $category) {
     $rows[] = array($category->category, $category->recipients, ($category->selected ? t('Yes') : t('No')), l(t('edit'), 'admin/build/contact/edit/' . $category->cid), l(t('delete'), 'admin/build/contact/delete/' . $category->cid));
   }
   $header = array(t('Category'), t('Recipients'), t('Selected'), array('data' => t('Operations'), 'colspan' => 2));
@@ -93,7 +93,7 @@ function contact_admin_edit_validate($fo
 function contact_admin_edit_submit($form, &$form_state) {
   if ($form_state['values']['selected']) {
     // Unselect all other contact categories.
-    db_query('UPDATE {contact} SET selected = 0');
+    db_update('contact')->fields(array('selected' => 0))->execute();
   }
   $recipients = explode(',', $form_state['values']['recipients']);
   foreach ($recipients as $key => $recipient) {
@@ -135,7 +135,7 @@ function contact_admin_delete(&$form_sta
  */
 function contact_admin_delete_submit($form, &$form_state) {
   $contact = $form_state['values']['contact'];
-  db_query("DELETE FROM {contact} WHERE cid = %d", $contact['cid']);
+  db_delete('contact')->condition('cid', $contact['cid'])->execute();
   drupal_set_message(t('Category %category has been deleted.', array('%category' => $contact['category'])));
   watchdog('mail', 'Contact form: category %category deleted.', array('%category' => $contact['category']), WATCHDOG_NOTICE);
 
Index: modules/contact/contact.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.module,v
retrieving revision 1.108
diff -u -p -r1.108 contact.module
--- modules/contact/contact.module	24 Jul 2008 16:25:17 -0000	1.108
+++ modules/contact/contact.module	31 Aug 2008 11:53:58 -0000
@@ -125,7 +125,7 @@ function _contact_user_tab_access($accou
  * Load the data for a single contact category.
  */
 function contact_load($cid) {
-  $contact = db_fetch_array(db_query("SELECT * FROM {contact} WHERE cid = %d", $cid));
+  $contact = db_query("SELECT * FROM {contact} WHERE cid = :cid", array(':cid' => $cid))->fetchAssoc();
   return empty($contact) ? FALSE : $contact;
 }
 
Index: modules/contact/contact.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.pages.inc,v
retrieving revision 1.11
diff -u -p -r1.11 contact.pages.inc
--- modules/contact/contact.pages.inc	16 Jul 2008 21:59:26 -0000	1.11
+++ modules/contact/contact.pages.inc	31 Aug 2008 11:53:58 -0000
@@ -27,9 +27,8 @@ function contact_mail_page() {
   global $user;
 
   $form = $categories = array();
-
   $result = db_query('SELECT cid, category, selected FROM {contact} ORDER BY weight, category');
-  while ($category = db_fetch_object($result)) {
+  foreach($result as $category) {
     $categories[$category->cid] = $category->category;
     if ($category->selected) {
       $default_category = $category->cid;
