-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit_function7t.php
54 lines (38 loc) · 1.4 KB
/
edit_function7t.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
<?php
require_once("config.php");
$database = "if15_jekavor";
function getSingeClothesData($edit_id){
$mysqli = new mysqli($GLOBALS["servername"], $GLOBALS["server_username"], $GLOBALS["server_password"], $GLOBALS["database"]);
$stmt = $mysqli->prepare("SELECT clothes, brand, size, color FROM faschion WHERE id=? AND deleted is NULL");
$stmt->bind_param("$i", $edit_id);
$stmt->bind_result($clothes, $brand, $size, $color);
$stmt->execute();
//tekitan objekti
$mode= new Stdclass();
//saime yhe rea andmeid
if($stmt->fetch()){
//saan siin alles kasutada bind_result muutujaid
$mode->clothes = $clothes;
$mode->brand = $brand;
$mode->size = $size;
$mode->color = $color;
}else{
header("Location: taabel.php");
}
return $mode;
$stmt->close();
$mysqli->close();
}
function updateClothes($id, $user_id, $clothes, $brand, $size, $color){
$mysqli = new mysqli($GLOBALS["servername"], $GLOBALS["server_username"], $GLOBALS["server_password"], $GLOBALS["database"]);
$stmt = $mysqli->prepare("UPDATE fashion SET user_id=?, clothes=?, brand=?, size=?, color=? WHERE id=?");
$stmt->bind_param("iissis", $id, $user_id, $clothes, $brand, $size, $color);
// kas 6nnestus salvestada
if($stmt->execute()) {
// 6nnestus
echo "hurraa";
}
$stmt->close();
$mysqli->close();
}
?>