-
Notifications
You must be signed in to change notification settings - Fork 1
/
crud.php
43 lines (37 loc) · 1.04 KB
/
crud.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
<?php
ob_start();
include_once 'baza.class.php';
include_once 'greske.php';
include_once 'dnevnik.php';
if(!isset($_SESSION))
{
session_start();
}
upisiLog("Rad s bazom", $_SESSION['korisnickoime']);
$baza = new baza();
$baza->spojiBaza();
if(isset($_POST['btnCRUD'])){
//$tablica = $_POST['imeTablica'];
//echo $tablica;
foreach ($_POST as $kljuc=>$vrijednost){
$polje[$kljuc]=$vrijednost;
}
$tablica = $polje['imeTablica'];
$upit = "UPDATE ".$tablica." SET ";
array_pop($polje);
array_pop($polje);
foreach($polje as $kljuc=>$vrijednost){
$upit .= $kljuc. "="."'".$vrijednost."'".",";
}
substr($upit, 0, -2);
$upit2 = mb_substr($upit, 0, -1, 'UTF-8');
foreach($polje as $kljuc=>$vrijednost){
$upit2 .= " WHERE " .$kljuc."="."'".$vrijednost."'"."";
break;
}
if($baza->ostaliUpiti($upit2)){
upisiLog("Rad s bazom", "ASMO TEST");
}
header( 'Location: administracijatablica.php' ) ;
}
?>