-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable_maintenance1.php
58 lines (47 loc) · 1.15 KB
/
table_maintenance1.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
<?php
/*
CREATE TABLE `categorias` (
`ctgid` BIGINT(8) NOT NULL AUTO_INCREMENT,
`ctgdsc` VARCHAR(45) NULL,
`ctgest` CHAR(3) NULL,
PRIMARY KEY (`ctgid`));
*/
$txtDsc = "";
$cmbEst = "ACT";
$last = "";
$conn = new mysqli("127.0.0.1","root",
"root","nw201501");
if($conn->errno){
die($conn->error);
}
if(isset($_POST["btnSave"])){
$txtDsc = $_POST["txtDsc"];
$cmbEst = $_POST["cmbEst"];
$insertSQL = "Insert into categorias (ctgdsc, ctgest) ";
$insertSQL .= "value ('".$txtDsc."','".$cmbEst."');";
$inserted = $conn->query($insertSQL);
$last = $conn->insert_id;
}
$str = "SELECT * from categorias;";
$cursor = $conn->query($str);
$categorias = array();
while($registro = $cursor->fetch_assoc()){
//obtenga el registro de forma associativa
/* $registro = array(
"ctgid"=> 1,
"ctgdsc"=> "Algun Valor",
"ctgest"=> "ACT"
);
*/
$categorias[]=$registro;
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>" "</title>
</head>
<body>
</body>
</html>