-
Notifications
You must be signed in to change notification settings - Fork 0
/
insert.php
31 lines (24 loc) · 858 Bytes
/
insert.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
<?php include("config/db.php");?>
<?php
$guardian_arr=array();
if(isset($_POST["subject"]))
{
$subject = mysqli_real_escape_string($conn, $_POST["subject"]);
$comment = mysqli_real_escape_string($conn, $_POST["comment"]);
$array_img_names=explode(', ',$comment);
foreach ($array_img_names as $img_name){
$sql="SELECT `guardian_name` FROM `find` WHERE `img_name`='$img_name'";
$result = mysqli_query($conn, $sql);
while($row = mysqli_fetch_array($result))
{
$guard_name=$row['guardian_name'];
// array_push($guardian_arr, $row['guardian_name']);
$query = "
INSERT INTO comments(comment_subject, comment_text, `send_to`)
VALUES ('$subject', '$img_name','$guard_name')
";
mysqli_query($conn, $query);
}
}
}
?>