function sendMessage($sender, $receiver, $message) { if (existType($receiver, $sender) == 1) { return 0; } $query = "insert into message (sender, receiver, content) values ('{$sender}', '{$receiver}', '{$message}')"; $result = mysql_query($query); if (!$result) { die("sendMessage() failed. Could not query the database: <br />" . mysql_error()); } return 1; }
function addContact($userid1, $userid2) { if (existType($userid2, $userid1) == 1) { return 0; } rmExist($userid1, $userid2); $query = "insert into contact values ('{$userid1}','{$userid2}', 3)"; $insert = mysql_query($query); if (!$insert) { die("Could not insert into the database: <br />" . mysql_error()); } return 1; }