-
Notifications
You must be signed in to change notification settings - Fork 0
/
updateprop.php
69 lines (54 loc) · 1.32 KB
/
updateprop.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
60
61
62
63
64
65
66
67
68
69
<?php
session_start();
?>
<?php
$localhost = "localhost";
$name = "root";
$password ="";
$dbname ="real estate";
$sellerid=$_SESSION['username'];
$conn=mysqli_connect($localhost,$name,$password,$dbname);
if(isset($_POST['submit'])){
$img=$_POST['img'];
$username=$_SESSION['username'];
$id= $_POST['propid'];
$area=$_POST['area'];
$type=$_POST['type'];
$location=$_POST['location'];
$nroom=$_POST['rooms'];
$nbed=$_POST['beds'];
$max=$_POST['max'];
$min=$_POST['min'];
$deal=$_POST['deal'];
$ava=$_POST['availability'];
echo"$location";
$usql=" UPDATE `property`
SET `type`='$type',
`roomnum`='$nroom',
`bednum`='$nbed',
`area`='$area',
`location`='$location',
`deal`='$deal',
`maxprice`='$max',
`minprice`='$min',
`availability`='$ava'
WHERE sellerID='$username AND propertyID='$id'";
$dsql="DELETE FROM `pictures` WHERE propertyID=$id";
if(mysqli_query($conn,$usql)){
echo "<script>alert('Query update done');</script>";
}
else{echo"Query update festek ".mysqli_error($conn);}
$result=mysqli_query($conn,$usql);
$dres=mysqli_query($conn,$dsql);
for($i=0;$i<count($img);$i++){
$pic=$img[$i];
$psql="INSERT INTO `pictures`(`picture`, `sellerID`, `propertyID`) VALUES ('$pic','$sellerid','$id')";
echo $img[$i];
$res=mysqli_query($conn,$psql);}
if($result){
echo 'success';
}
else{
echo mysqli_error($conn);
}}
?>