I am unable to update my table

Asked

Viewed 30 times

1

Good afternoon, I’m developing an online bookmarking site, and in the part of the administrator where he controls the schedules of the table had created a field that can make changes at the time of the table... where that table is shown to the user where he see what schedules are available. In this field that I created so the administrator can change is not working, it does not present me any error, and when I click on the button to finish, there in the database does not suffer any changes... one can notice that I take the id and put the time that he wants to change, because each day of the week has a table, (second table, third table, fourth table and so on). My problem is that it does not suffer any changes when I give UPDATE

code change.php

<?php
$idSeg = filter_input(INPUT_GET, "id-segunda");
$seg = filter_input(INPUT_GET, "seg");

$idTerca = filter_input(INPUT_GET, "id-ter");
$tercaa = filter_input(INPUT_GET, "ter");


$idQuarta = filter_input(INPUT_GET, "id-quarta");
$quartaa = filter_input(INPUT_GET, "qua");


$idQuinta = filter_input(INPUT_GET, "id-quinta");
$quintaa = filter_input(INPUT_GET, "qui");

$idSexta = filter_input(INPUT_GET, "id-sexta");
$sextaa = filter_input(INPUT_GET, "sex");

$idSabado = filter_input(INPUT_GET, "id-sabado");
$sabadoo = filter_input(INPUT_GET, "sab");


include("conexao.php");

if($idSeg && $seg && $idTerca && $tercaa && $idQuarta && $quartaa &&
     $idQuinta && $quintaa && $idSexta && $sextaa && $idSabado && $sabadoo ) {

    if($link) {
    $segg = mysqli_query($link, "UPDATE horas_segunda set horas_de_segunda='$seg' where id='$idSeg';");
    $terc = mysqli_query($link, "UPDATE horas_terca set horas_de_terca='$tercaa' where id='$idTerca';");
    $quarr = mysqli_query($link, "UPDATE horas_quarta set horas_de_quarta='$quartaa' where id='$idQuarta';");
    $quinn = mysqli_query($link, "UPDATE horas_quinta set horas_de_quinta='$quintaa' where id='$idQuinta';");
    $sexx = mysqli_query($link, "UPDATE horas_sexta set horas_de_sexta='$sextaa' where id='$idSexta';");
    $sabaa = mysqli_query($link, "UPDATE horas_sabado set horas_de_sabado='$sabadoo' where id='$idSabado';");

    header("Location: ../Adm/AdmAgenda.php");
 }
    else {
    die("Erro: " .mysqli_error($link));
 }
}

?>

html code

<?php include("../php/agenda.php"); include("../php/alterar.php"); include("../php/HorasDisponivel.php") ?>


<!DOCTYPE html>
<html lang="pt-br" ng-app="AngularADM">
<head>
    <meta charset="utf-8">
    <title>Administração</title>
    <link rel="stylesheet" type="text/css" href="../css/visual.css">
    <!-- responsivo -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/bootstrap.css" rel="stylesheet">
    <link href="../css/bootstrap-theme.css" rel="stylesheet">
    <link href="../css/bootstrap-theme.css.map" rel="stylesheet">
    <link href="../css/bootstrap-theme.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
    <script src="../js/jqueryAtualizado.js"></script>
    <script src="../js/jqueryAtualizado.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <script src="../js/bootstrap.min.js"></script>
    <!-- Fim responsivo -->
    <script src="../js/angular.min.js"></script>
</head>

<body ng-controller="TempoHorasP1">
    <header id="header">
        <div class="container">
            <div class="row">
                <div class="col-md-12">
                    <div class="block-left">
                        <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
                            <div class="container-fluid">
                                <div class="navbar-header">
                                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                                        <span class="sr-only">toggle navigation</span>
                                        <span class="icon-bar"></span>
                                        <span class="icon-bar"></span>
                                        <span class="icon-bar"></span>
                                        <span class="icon-bar"></span>
                                    </button>
                                    <div class="nav-logo col-md-8 righ-menu">
                                        <img src="../Imagens/logo-branco.png" alt="Studio 7 Hair">
                                    </div>
                                </div>

                                <div class="collapse navbar-collapse col-md-4" id="bs-example-navbar-collapse-1">
                                    <ul class="nav navbar-nav">
                                        <li class="active"><a href="AdmAgenda.php" class="item-menu-adm"><span>Seja bem vindo</span></a></li>
                                        <li><a class="item-menu-adm"><span>Configuração da Agenda</span><span class="sr-only">(current)</span></a></li>
                                        <li><a href="cadastro.html" class="item-menu-adm"><span>Cadastrar Administrador</span><span class="sr-only">(current)</span></a></li>
                                        <li><a href="https://www.miyomic.com.br" class="item-menu-adm"><span>Solicitar Ajuda</span></a></li>

                                    </ul>
                                </div>
                            </div>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    </header>
    <div class="container">
        <div class="row">
            <h2 class="dourado texto-centro margin-top30 bold">Configuração da agenda online</h2>
        </div>
        <div class="form-alterar margin-top40 texto-centro">
            <h3 class="margin-top20 dourado">Área de alteração dos horários</h3>
            <div class="row">
                <div class="col-lg-3 texto-centro bloco-hora-alte">
                    <p>Segunda feira</p>

                    <form action="../php/alterar.php" name="segunda">
                        <div class="col-lg-6">
                            <input type="text" name="id-segunda" class="campo-alteracao" placeholder="Id" />
                        </div>

                        <div class="col-lg-6">
                            <input type="text" name="seg" class="campo-alteracao" placeholder="Horas" />
                        </div>

                        <br />

                        <div class="botao-edit">
                            <a class="botao-alterar">
                                <span class="glyphicon glyphicon-floppy-saved"></span>
                                <input type="submit" class="invisivel" value="Alterar" />
                            </a>
                        </div>
                    </form>
                </div>

                <div class="col-lg-3 texto-centro bloco-hora-alte">
                    <p>Terça feira</p>

                    <form action="../php/alterar.php" name="terca">
                        <div class="col-lg-6">
                            <input type="text" name="id-ter" class="campo-alteracao" placeholder="Id" />
                        </div>

                        <div class="col-lg-6">
                            <input type="text" name="ter" class="campo-alteracao" placeholder="Horas" />
                        </div>

                        <br />

                        <div class="botao-edit">
                            <a class="botao-alterar">
                                <span class="glyphicon glyphicon-floppy-saved"></span>
                                <input type="submit" class="invisivel" value="Alterar" />
                            </a>
                        </div>
                    </form>
                </div>

                <div class="col-lg-3 texto-centro bloco-hora-alte">
                    <p>Quarta feira</p>

                    <form action="../php/alterar.php" name="quarta">
                        <div class="col-lg-6">
                            <input type="text" name="id-quarta" class="campo-alteracao" placeholder="Id" />
                        </div>

                        <div class="col-lg-6">
                            <input type="text" name="qua" class="campo-alteracao" placeholder="Horas" />
                        </div>

                        <br />

                        <div class="botao-edit">
                            <a class="botao-alterar">
                                <span class="glyphicon glyphicon-floppy-saved"></span>
                                <input type="submit" class="invisivel" value="Alterar" />
                            </a>
                        </div>
                    </form>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-3 texto-centro bloco-hora-alte">
                    <p>Quinta feira</p>
                    <form action="../php/alterar.php" name="quinta">
                        <div class="col-lg-6">
                            <input type="text" name="id-quinta" class="campo-alteracao" placeholder="Id" />
                        </div>

                        <div class="col-lg-6">
                            <input type="text" name="qui" class="campo-alteracao" placeholder="Horas" />
                        </div>

                        <br />

                        <div class="botao-edit">
                            <a class="botao-alterar">
                                <span class="glyphicon glyphicon-floppy-saved"></span>
                                <input type="submit" class="invisivel" value="Alterar" />
                            </a>
                        </div>
                    </form>
                </div>

                <div class="col-lg-3 texto-centro bloco-hora-alte">
                    <p>Sexta feira</p>

                    <form action="../php/alterar.php" name="sexta">
                        <div class="col-lg-6">
                            <input type="text" name="id-sexta" class="campo-alteracao" placeholder="Id" />
                        </div>

                        <div class="col-lg-6">
                            <input type="text" name="sex" class="campo-alteracao" placeholder="Horas" />
                        </div>

                        <br />

                        <div class="botao-edit">
                            <a class="botao-alterar">
                                <span class="glyphicon glyphicon-floppy-saved"></span>
                                <input type="submit" class="invisivel" value="Alterar" />
                            </a>
                        </div>
                    </form>
                </div>

                <div class="col-lg-3 texto-centro bloco-hora-alte">
                    <p>Sabádo feira</p>

                    <form action="../php/alterar.php" name="sabado">
                        <div class="col-lg-6">
                            <input type="text" name="id-sabado" class="campo-alteracao" placeholder="Id" />
                        </div>

                        <div class="col-lg-6">
                            <input type="text" name="sab" class="campo-alteracao" placeholder="Horas" />
                        </div>

                        <br />

                        <div class="botao-edit">
                            <a class="botao-alterar">
                                <span class="glyphicon glyphicon-floppy-saved"></span>
                                <input type="submit" class="invisivel" value="Alterar" />
                            </a>
                        </div>
                    </form>
                </div>
            </div>
            <div class="alert alert-danger" role="alert">Para poder ter sucesso na alteração da agenda terá que ver qual id que deseja para poder selecionar</div>
        </div>
    </div>
</body>
</html>

If anyone can help me I’m grateful...

1 answer

0

Your mistake is logical, here:

if($idSeg && $seg && $idTerca && $tercaa && $idQuarta && $quartaa &&
     $idQuinta && $quintaa && $idSexta && $sextaa && $idSabado && $sabadoo ) {
.
.

The excerpt will only be executed if all variables are true, better check the condition you want to make the corrections.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.