/[libdata]/trunk/admin/include/insert.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/admin/include/insert.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 41 by dpavlin, Fri Dec 5 18:34:18 2003 UTC revision 42 by dpavlin, Thu Mar 4 22:43:50 2004 UTC
# Line 86  function insertCoursesub($con, $campus_i Line 86  function insertCoursesub($con, $campus_i
86                          . ")";                          . ")";
87                    
88                  // Write the new row to the database                  // Write the new row to the database
89                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
90                          sql_err($con);                          sql_err($con);
91                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
92                          bailout();                          bailout();
93                  }                  }
94                  else {                  else {
95                          printf("Added Course Subject <b>%s</b>.<BR>", $coursesub_display);                          printf("Added Course Subject <b>%s</b>.<BR>", $coursesub_display);
96                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
97                  }                  }
98          }          }
99          else printf("%s", $err_msg);          else printf("%s", $err_msg);
# Line 165  function insertFaculty($con, $faculty_em Line 165  function insertFaculty($con, $faculty_em
165                          . "')";                          . "')";
166                                    
167                  // Write the new row to the database                  // Write the new row to the database
168                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
169                          sql_err($con);                          sql_err($con);
170                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
171                          bailout();                          bailout();
172          }          }
173                  else {                  else {
174                          printf("Added <b>%s</b> to the faculty table.<BR>\n", $faculty_name_display);                          printf("Added <b>%s</b> to the faculty table.<BR>\n", $faculty_name_display);
175                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
176                  }                  }
177          }          }
178                    
# Line 238  function insertFeature($con, $feature, $ Line 238  function insertFeature($con, $feature, $
238                          . "')";                          . "')";
239                    
240                  // Write the new row to the database                  // Write the new row to the database
241                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
242                          sql_err($con);                          sql_err($con);
243                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
244                          bailout();                          bailout();
245          }          }
246                  else {                  else {
247                          printf("Added Feature <b>%s</b>.<BR>", $feature_display);                          printf("Added Feature <b>%s</b>.<BR>", $feature_display);
248                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
249                  }                  }
250          }          }
251          else printf("%s", $err_msg);          else printf("%s", $err_msg);
# Line 311  function insertInfotype($con, $infotype, Line 311  function insertInfotype($con, $infotype,
311                          . ")";                          . ")";
312                                    
313                  // Write the new row to the database                  // Write the new row to the database
314                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
315                          sql_err($con);                          sql_err($con);
316                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
317                          bailout();                          bailout();
318                  }                  }
319                  else {                  else {
320                          printf("Added Information Type <b>%s</b>.<BR>", $infotype_display);                          printf("Added Information Type <b>%s</b>.<BR>", $infotype_display);
321                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
322                  }                  }
323          }          }
324    
# Line 399  function insertLibunit($con, $head_staff Line 399  function insertLibunit($con, $head_staff
399                          . ")";                          . ")";
400                                    
401                  // Write the new row to the database                  // Write the new row to the database
402                  mysql_query ("LOCK TABLE libunit WRITE", $con);                  xx_query ("LOCK TABLE libunit WRITE", $con);
403                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
404                          sql_err($con);                          sql_err($con);
405                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
406                          bailout();                          bailout();
407          }          }
408                  else {                  else {
409                          $libunit_id = mysql_insert_id($con);                                      $libunit_id = xx_insert_id($con);              
410                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
411                          formLibunit($con, $libunit_id);                          formLibunit($con, $libunit_id);
412                  }                  }
413          }          }
# Line 513  function insertLocation($con, $address1, Line 513  function insertLocation($con, $address1,
513                          . "')";                          . "')";
514    
515                  // Write the new row to the database                  // Write the new row to the database
516                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
517                          sql_err($con);                          sql_err($con);
518                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
519                          bailout();                          bailout();
520                  }                  }
521                  else {                  else {
522    
523                          printf("Added <b>%s</b> location.", $location_display);                          printf("Added <b>%s</b> location.", $location_display);
524                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
525                  }                  }
526          }          }
527                    
# Line 618  function insertResource($con, $annotatio Line 618  function insertResource($con, $annotatio
618                  // printf("sql was: %s<BR>", $sql);                  // printf("sql was: %s<BR>", $sql);
619    
620                  // Write the new record to the database                  // Write the new record to the database
621                  mysql_query ("LOCK TABLE resource WRITE", $con);                  xx_query ("LOCK TABLE resource WRITE", $con);
622                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
623                          sql_err($con);                          sql_err($con);
624                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
625                          bailout();                          bailout();
626                  }                  }
627                  else {                  else {
628                          $resource_id = mysql_insert_id($con);                          $resource_id = xx_insert_id($con);
629                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
630    
631                          // Now set up this resource with its first mastersubject                          // Now set up this resource with its first mastersubject
632                          // Note that id#1 = N/A and id#2 = (All), and are not used here.                          // Note that id#1 = N/A and id#2 = (All), and are not used here.
# Line 638  function insertResource($con, $annotatio Line 638  function insertResource($con, $annotatio
638                                          . ")";                                          . ")";
639    
640                                  // Write the new res_mastersubject to the database                                  // Write the new res_mastersubject to the database
641                                  mysql_query ("LOCK TABLE res_mastersubject WRITE", $con);                                  xx_query ("LOCK TABLE res_mastersubject WRITE", $con);
642                                  if (!mysql_query($sql, $con)){                                  if (!xx_query($sql, $con)){
643                                          sql_err($con);                                          sql_err($con);
644                                          mysql_query ("UNLOCK TABLES", $con);                                          xx_query ("UNLOCK TABLES", $con);
645                                          bailout();                                          bailout();
646                                  }                                  }
647                                  else {                                  else {
648                                          mysql_query("UNLOCK TABLES", $con);                                          xx_query("UNLOCK TABLES", $con);
649                                  }                                  }
650                          }                          }
651                  }                  }
# Line 731  function insertSingleField($con, $displa Line 731  function insertSingleField($con, $displa
731                  // Debugging                  // Debugging
732                  // printf("sql was: %s<br>", $sql);                  // printf("sql was: %s<br>", $sql);
733    
734                  if (!mysql_query ($sql, $con)){                  if (!xx_query ($sql, $con)){
735                          sql_err($sql);                          sql_err($sql);
736                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
737                          bailout();                          bailout();
738                  }                  }
739                  else {                  else {
740                          $new_id = mysql_insert_id($con);                          $new_id = xx_insert_id($con);
741                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
742                          printf("%s <b>%s</b> successfully added.\n", $display, $newValue_display);                          printf("%s <b>%s</b> successfully added.\n", $display, $newValue_display);
743                  }                  }
744          }          }
# Line 823  function insertService($con, $address1, Line 823  function insertService($con, $address1,
823                          . "')";                          . "')";
824                                    
825                  // Write the new row to the database                  // Write the new row to the database
826                  mysql_query ("LOCK TABLE service WRITE", $con);                  xx_query ("LOCK TABLE service WRITE", $con);
827                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
828                          sql_err($con);                          sql_err($con);
829                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
830                          bailout();                          bailout();
831                  }                  }
832                  else {                  else {
833                          $service_id = mysql_insert_id($con);                          $service_id = xx_insert_id($con);
834                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
835                          formService($con, $service_id);                                          formService($con, $service_id);                
836                  }                  }
837          }          }
# Line 929  function insertStaff($con, $access_id, $ Line 929  function insertStaff($con, $access_id, $
929                  // printf("sql was: %s<br><br>\n", $sql);                  // printf("sql was: %s<br><br>\n", $sql);
930                                    
931                  // Write the new row to the database                  // Write the new row to the database
932                  mysql_query ("LOCK TABLE staff WRITE", $con);                  xx_query ("LOCK TABLE staff WRITE", $con);
933                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
934                          sql_err($con);                          sql_err($con);
935                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
936                          bailout();                          bailout();
937          }          }
938                  else {                  else {
939    
940                          // Success, call formStaff back.                          // Success, call formStaff back.
941                          $staff_id = mysql_insert_id($con);                          $staff_id = xx_insert_id($con);
942                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
943                          formStaff($con, $staff_id);                          formStaff($con, $staff_id);
944                  }                  }
945          }          }
# Line 1019  function insertStyle($con, $css_file, $f Line 1019  function insertStyle($con, $css_file, $f
1019                          . "')";                          . "')";
1020                                    
1021                  // Write the new row to the database                  // Write the new row to the database
1022                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
1023                          sql_err($con);                          sql_err($con);
1024                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
1025                          bailout();                          bailout();
1026                  }                  }
1027                  else {                  else {
1028                          mysql_query("UNLOCK TABLES", $con);                                                      xx_query("UNLOCK TABLES", $con);                        
1029                          printf("Added <b>%s</b> style.<br><br>\n", $style_title_display);                          printf("Added <b>%s</b> style.<br><br>\n", $style_title_display);
1030                  }                  }
1031          }          }
# Line 1086  function insertSubject($con, $sess_staff Line 1086  function insertSubject($con, $sess_staff
1086                          . "')";                          . "')";
1087                                    
1088                  // Write the new row to the database                  // Write the new row to the database
1089                  mysql_query ("LOCK TABLE subject WRITE", $con);                  xx_query ("LOCK TABLE subject WRITE", $con);
1090                  if (!mysql_query($sql, $con)){                  if (!xx_query($sql, $con)){
1091                          sql_err($con);                          sql_err($con);
1092                          mysql_query ("UNLOCK TABLES", $con);                          xx_query ("UNLOCK TABLES", $con);
1093                          bailout();                          bailout();
1094                  }                  }
1095                  else {                  else {
1096                          $subject_id = mysql_insert_id($con);                                              $subject_id = xx_insert_id($con);                      
1097                          mysql_query("UNLOCK TABLES", $con);                          xx_query("UNLOCK TABLES", $con);
1098    
1099                          // Insert this staff person as an assigned staff member to this subject                          // Insert this staff person as an assigned staff member to this subject
1100                          $sql = "INSERT INTO sub_staff (subject_id, staff_id) VALUES ("                          $sql = "INSERT INTO sub_staff (subject_id, staff_id) VALUES ("
# Line 1103  function insertSubject($con, $sess_staff Line 1103  function insertSubject($con, $sess_staff
1103                                  . $sess_staff_id                                  . $sess_staff_id
1104                                  . ")";                                  . ")";
1105                                                                    
1106                          if (!mysql_query($sql, $con)){                          if (!xx_query($sql, $con)){
1107                                  sql_err($con);                                  sql_err($con);
1108                                  mysql_query ("UNLOCK TABLES", $con);                                  xx_query ("UNLOCK TABLES", $con);
1109                                  bailout();                                  bailout();
1110                          }                          }
1111                          else {                                    else {          
1112                                  mysql_query("UNLOCK TABLES", $con);                                  xx_query("UNLOCK TABLES", $con);
1113                          }                          }
1114                                                    
1115                          formSubject($con, $subject_id);                          formSubject($con, $subject_id);

Legend:
Removed from v.41  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26