-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinc.funcao.php
More file actions
88 lines (70 loc) · 2.01 KB
/
Copy pathinc.funcao.php
File metadata and controls
88 lines (70 loc) · 2.01 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
// INSERTS
function insertForn($form, $link) {
$query = 'INSERT INTO fornecedor (
nome,
ende)
VALUES("'.$form['nome'].'",
"'.$form['ende'].'")';
mysql_query($query, $link) or die(mysql_error());
mysql_close();
}
function insertFilial($form, $link) {
$query = 'INSERT INTO filial (
nome,
ende)
VALUES("'.$form['nome'].'",
"'.$form['ende'].'")';
mysql_query($query, $link) or die(mysql_error());
mysql_close();
}
function insertVenda($form, $link){
$query = 'INSERT INTO venda_itens (
id_produto,
qtd,
valor)
VALUES("'.$form['id_produto'].'",
"'.$form['qtd'].'",
"'.$form['valor'].'")';
mysql_query($query, $link) or die(mysql_error());
mysql_close();
}
function insertCliente($form, $link){
$query = 'INSERT INTO cliente (
nome,
email,
senha,
img)
VALUES("'.$form['nome'].'",
"'.$form['email'].'","'.$form['senha'].'","'.$form['nome_image'].'")';
mysql_query($query, $link) or die(mysql_error());
mysql_close();
}
// SELECT
function mostraInformacoes($table, $order, $link){
$query = 'SELECT *
FROM '.$table.'
ORDER BY '.$order;
$form['res'] = mysql_query($query, $link);
$form['qtd'] = mysql_num_rows($form['res']);
return $form;
}
// DELETE
function deleteItem($table, $id, $link) {
$query = 'DELETE FROM '.$table.'
WHERE id_'.$table.' = '.$id;
mysql_query($query, $link) or die(mysql_error());
mysql_close();
}
function deleteCliente($table, $id, $link) {
$query = 'DELETE FROM '.$table.'
WHERE id = '.$id;
mysql_query($query, $link) or die(mysql_error());
mysql_close();
}
function updateItem($table, $form, $link, $id) {
$query = 'UPDATE '.$table.' SET nome = "'.$form['nome'].'", ende = "'.$form['ende'].'" WHERE id_'.$table.' = '.$id;
mysql_query($query, $link) or die(mysql_error());
mysql_close();
}
?>