|
|
@ -34,14 +34,16 @@ switch ($submit = form_get_action()) { |
|
|
|
case 'insert': |
|
|
|
case 'insert': |
|
|
|
$description = sanitize($_POST['description']); |
|
|
|
$description = sanitize($_POST['description']); |
|
|
|
$color = sanitize($_POST['color']); |
|
|
|
$color = sanitize($_POST['color']); |
|
|
|
|
|
|
|
$type = sanitize($_POST['cable_type']); |
|
|
|
$info = sanitize($_POST['info']); |
|
|
|
$info = sanitize($_POST['info']); |
|
|
|
$sql = "INSERT INTO cable |
|
|
|
$sql = "INSERT INTO cable |
|
|
|
(cable_description, cable_color, cable_info) |
|
|
|
(cable_description, cable_color, cable_type, cable_info) |
|
|
|
VALUES |
|
|
|
VALUES |
|
|
|
(:description, :color, :info)"; |
|
|
|
(:description, :color, :type, :info)"; |
|
|
|
$sth = $dbh->prepare($sql); |
|
|
|
$sth = $dbh->prepare($sql); |
|
|
|
$sth->bindValue(':description', $description, PDO::PARAM_STR); |
|
|
|
$sth->bindValue(':description', $description, PDO::PARAM_STR); |
|
|
|
$sth->bindValue(':color', $color, PDO::PARAM_STR); |
|
|
|
$sth->bindValue(':color', $color, PDO::PARAM_STR); |
|
|
|
|
|
|
|
$sth->bindValue(':type', $type, PDO::PARAM_STR); |
|
|
|
$sth->bindValue(':info', $info, PDO::PARAM_STR); |
|
|
|
$sth->bindValue(':info', $info, PDO::PARAM_STR); |
|
|
|
$sth->execute(); |
|
|
|
$sth->execute(); |
|
|
|
$id = $dbh->lastInsertId(); |
|
|
|
$id = $dbh->lastInsertId(); |
|
|
@ -53,12 +55,14 @@ switch ($submit = form_get_action()) { |
|
|
|
$color = sanitize($_POST['color']); |
|
|
|
$color = sanitize($_POST['color']); |
|
|
|
$length = sanitize($_POST['length']); |
|
|
|
$length = sanitize($_POST['length']); |
|
|
|
$type = sanitize($_POST['cable_type']); |
|
|
|
$type = sanitize($_POST['cable_type']); |
|
|
|
|
|
|
|
$links = sanitize($_POST['links']); |
|
|
|
$info = sanitize($_POST['info']); |
|
|
|
$info = sanitize($_POST['info']); |
|
|
|
$sql = "UPDATE cable |
|
|
|
$sql = "UPDATE cable |
|
|
|
SET cable_description=:desc, |
|
|
|
SET cable_description=:desc, |
|
|
|
cable_color=:color, |
|
|
|
cable_color=:color, |
|
|
|
cable_length=:length, |
|
|
|
cable_length=:length, |
|
|
|
cable_type=:type, |
|
|
|
cable_type=:type, |
|
|
|
|
|
|
|
cable_links=:links, |
|
|
|
cable_info=:info |
|
|
|
cable_info=:info |
|
|
|
WHERE cable_id=:id"; |
|
|
|
WHERE cable_id=:id"; |
|
|
|
$sth = $dbh->prepare($sql); |
|
|
|
$sth = $dbh->prepare($sql); |
|
|
@ -67,6 +71,7 @@ switch ($submit = form_get_action()) { |
|
|
|
$sth->bindValue(':length', $length, PDO::PARAM_INT); |
|
|
|
$sth->bindValue(':length', $length, PDO::PARAM_INT); |
|
|
|
$sth->bindValue(':color', $color, PDO::PARAM_STR); |
|
|
|
$sth->bindValue(':color', $color, PDO::PARAM_STR); |
|
|
|
$sth->bindValue(':type', $type, PDO::PARAM_STR); |
|
|
|
$sth->bindValue(':type', $type, PDO::PARAM_STR); |
|
|
|
|
|
|
|
$sth->bindValue(':links', $links, PDO::PARAM_INT); |
|
|
|
$sth->bindValue(':info', $info, PDO::PARAM_STR); |
|
|
|
$sth->bindValue(':info', $info, PDO::PARAM_STR); |
|
|
|
$sth->execute(); |
|
|
|
$sth->execute(); |
|
|
|
$action = ACT_VIEW; |
|
|
|
$action = ACT_VIEW; |
|
|
|