Meno:
Meno: url ?>
id; $db_result = mysql_query($db_query); if (!$db_result) die ('Chyba SQL: ' . mysql_error() . " " .$db_query); else { $db_row = mysql_fetch_row($db_result); $this->id = $db_row[0]; $this->url = $db_row[1]; } } /* }}} */ public function data_insert() { /* {{{ *********************************/ db_connect(); $db_query = "INSERT INTO c_email (" . ($this->id > 0? "pk_c_email, " : ""). "url ". ") VALUES (". ($this->id > 0? "'" . $this->id . "', ": ""). "'". $this->url . "')"; $db_result = mysql_query($db_query); if (!$db_result) die ('Chyba SQL: ' . mysql_error() . " " .$db_query); else $this->id = mysql_insert_id(); return true; } /* }}} */ public function data_update() { /* {{{ *********************************/ db_connect(); $db_query = "UPDATE c_email SET " . "url='". $this->url . "' ". "WHERE pk_c_email='". $this->id ."'"; if ($this->id > 0) $db_result = mysql_query($db_query); if (!$db_result) die ('Chyba SQL: ' . mysql_error() . " " .$db_query); return true; } /* }}} */ public function data_delete() { /* {{{ *********************************/ db_connect(); $db_query = "DELETE FROM c_join_person_email " . "WHERE " . "fk_c_email='". $this->id ."' AND ". "fk_c_person='". $_GET["id_person"] . "'"; $db_result = false; if ($this->id > 0) $db_result = mysql_query($db_query); if (!$db_result) die ('Chyba SQL: ' . mysql_error() . " " .$db_query); return true; } /* }}} */ public function data_insert_relation_person($p_id_person) { /* {{{ ********/ db_connect(); $db_query = "INSERT INTO c_join_person_email (". "fk_c_email, ". "fk_c_person ". ") VALUES (" . $this->id .",". $p_id_person .")"; $db_result = mysql_query($db_query); if (!$db_result) die (MSG_ERROR_SQL . mysql_error() . " " .$db_query); return true; } /* }}} */ public function data_insert_relation_company($p_id_company) { /* {{{ ******/ db_connect(); $db_query = "INSERT INTO c_join_company_email (". "fk_c_email, ". "fk_c_company ". ") VALUES (" . $this->id .",". $p_id_company .")"; $db_result = mysql_query($db_query); if (!$db_result) die (MSG_ERROR_SQL . mysql_error() . " " .$db_query); return true; } /* }}} */ public function print_list_person() { /* {{{ ******************************/ db_connect(); $db_query = "SELECT ". "pk_c_join_person_email, ". "pk_c_person, " . "priority, ". "note, " . "name, " . "surname " . "FROM c_join_person_email ". "INNER JOIN c_person ON fk_c_person=pk_c_person " . "WHERE fk_c_email=" . $this->id . " " . "ORDER BY surname"; $db_result = mysql_query($db_query); if (!$db_result) die (MSG_ERROR_SQL . mysql_error() . " " . $db_query); else if (mysql_num_rows($db_result)>0) { ?>
id . " " . "GROUP BY pk_c_company " . "ORDER BY c_company.name"; $db_result = mysql_query($db_query); if (!$db_result) die (MSG_ERROR_SQL . mysql_error() . " " . $db_query); else if (mysql_num_rows($db_result)>0) { ?>
0) { ?>