-
Notifications
You must be signed in to change notification settings - Fork 94
/
Copy pathget_bot_message.php
59 lines (48 loc) · 1.21 KB
/
get_bot_message.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
date_default_timezone_set('Asia/Dhaka');
require_once 'dbconfig/config.php';
$stmt = $db->quote($_POST['txt']);
$sql="SELECT reply from chatbot_hints WHERE question LIKE $stmt";
$result = $db->prepare($sql);
$result->execute();
if($result->rowCount() > 0){
$row = $result->fetch(PDO::FETCH_ASSOC);
$content = $row['reply'];
}else{
$content = "Sorry not be able to understand you";
}
$result->closeCursor();
$added_on=date('Y-m-d h:i:s');
$db->prepare("INSERT INTO message(message,added_on,type) VALUES('$stmt','$added_on','user')");
/*
********************
NO Need to do this
**$db->execute();
**$db->closeCursor();
*********************
*/
$added_on=date('Y-m-d h:i:s');
$db->prepare("INSERT INTO message(message,added_on,type) VALUES('$content','$added_on','bot')");
/*
********************
** NO Need to do this
** $db->execute();
** $db->closeCursor();
**********************
*/
echo $content;
echo " ";
?>
<!--
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<style>
<link href="style.css" rel="stylesheet">
</style>
<a href="#"><small><input name="invalid" type="button" id="admin_btn" value="Invalid?"></small></a>
<body>
</body>
</html>-->