Пример #1
0
 $endeinh = strpos($field[$i], '"', $begineinh);
 //echo $endeinh.'<br>';
 $einheit = substr($field[$i], $begineinh, $endeinh - $begineinh);
 //echo $einheit.'<br>';
 $sql_query = "SELECT * FROM einheit WHERE kurzbz='{$einheit}'";
 $result = $db->db_query($sql_query);
 $rows = $db->db_num_rows($result);
 if ($rows == 0) {
     $result_ins = $db->db_query("INSERT INTO einheit (kurzbz) VALUES ('{$einheit}')");
     if (!$result_ins) {
         error($db->db_last_error());
     }
     $sql_query = "SELECT * FROM einheit WHERE kurzbz='{$einheit}'";
     $result = $db->db_query($sql_query);
 }
 $row = $db->_fetch_object($result, 0);
 $einheit_id = $row->id;
 $sql_query = "SELECT * FROM student WHERE uid='{$uid}'";
 //echo $sql_query.'<BR>';
 $result = $db->db_query($sql_query);
 if (!$result) {
     error($db->db_last_error());
 }
 $rows = $db->db_num_rows($result);
 if ($rows == 0) {
     die("Student {$uid} not found!");
 }
 $row = $db->db_fetch_object($result, 0);
 $student_id = $row->id;
 $sql_query = "SELECT * FROM einheitstudent WHERE einheit_id={$einheit_id} AND student_id={$student_id}";
 $rows = 0;