forked from pokepark/PokemonRaidBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsert_overview.php
42 lines (39 loc) · 1.22 KB
/
insert_overview.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* Insert overview.
* @param $chat_id
* @param $message_id
* @param $chat_title
* @param $chat_username
*/
function insert_overview($chat_id, $message_id, $chat_title, $chat_username)
{
// Build query to check if overview details are already in database or not
$rs = my_query(
"
SELECT COUNT(*) AS count
FROM overview
WHERE chat_id = '{$chat_id}'
"
);
$row = $rs->fetch();
// Overview already in database or new
if (empty($row['count'])) {
// Build query for overview table to add overview info to database
debug_log('Adding new overview information to database overview list!');
$rs = my_query(
"
INSERT INTO overview
SET chat_id = '{$chat_id}',
message_id = '{$message_id}',
chat_title = '{$chat_title}',
chat_username = '{$chat_username}',
updated = DATE(NOW())
"
);
} else {
// Nothing to do - overview information is already in database.
debug_log('Overview information is already in database! Nothing to do...');
}
}
?>