-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsert.php
More file actions
44 lines (34 loc) · 760 Bytes
/
insert.php
File metadata and controls
44 lines (34 loc) · 760 Bytes
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
<?php
$mysql_host='localhost';
$mysql_user='root';
$mysql_password='';
$con= mysqli_connect('localhost','root','','dbms');
$consumer_name=$_POST['name'];
$dob=$_POST['dob'];
$consumer_address=$_POST['address'];
$gender=$_POST['gender'];
$region=$_POST['region'];
$sql=
"
INSERT INTO consumer(consumer_name,consumer_address,dob,gender)
VALUES ('$consumer_name','$consumer_address','$dob','$gender')
";
if(mysqli_query($con,$sql))
{
echo 'inserted';
}
else
{
echo 'not inserted';
}
$r=
"
INSERT INTO consumption(region_id,consumer_id)
SELECT region_id,consumer_id
FROM region,consumer
WHERE consumer_name='$consumer_name' AND region_name='$region';
";
if(mysqli_query($con,$r));
echo "sucessful 2nd query";
header("refresh:2;url=front.html")
?>