forked from pokepark/PokemonRaidBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsert_trainerinfo.php
37 lines (34 loc) · 1 KB
/
insert_trainerinfo.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
<?php
/**
* Insert trainer info.
* @param $chat_id
* @param $message_id
*/
function insert_trainerinfo($chat_id, $message_id)
{
// Build query to check if trainer info details are already in database or not
$rs = my_query(
"
SELECT COUNT(*) AS count
FROM trainerinfo
WHERE chat_id = '{$chat_id}'
"
);
$row = $rs->fetch();
// Trainer info already in database or new
if (empty($row['count'])) {
// Build query for trainerinfo table to add trainer info to database
debug_log('Adding new trainer information to database trainer info list!');
$rs = my_query(
"
INSERT INTO trainerinfo
SET chat_id = '{$chat_id}',
message_id = '{$message_id}'
"
);
} else {
// Nothing to do - trainer information is already in database.
debug_log('Trainer information is already in database! Nothing to do...');
}
}
?>