My database does not register the data in mysql

Asked

Viewed 68 times

1

Guys, I’m trying to insert some data in my comic book, I’ve done this action in other systems and it always worked, but this time it’s not giving, it shows no error message, it just doesn’t include in the bank, I tried to make the Insert in other ways but it didn’t work (the bottom code is the last attempt I made), I gave an echo in sql and he’s right, he just doesn’t add the entries in the bank, the names are all correct, would it help? thanks in advance.

<?php
    include_once "conexao.php";
    //include_once "defines.php";
    //require_once('classes/BD.class.php');
    //BD::conn();

    if(isset($_POST['prox'])){
        $nome = 'Giovani';
        $data = strip_tags(trim(filter_input(INPUT_POST, 'data', FILTER_SANITIZE_STRING)));
        $sala = '1';
        $computador = 's';
        $projetor = 's';
        $som = 's';
        $microfone = 'n';

        if (empty($data)) {
            echo '<div class="alert alert-danger" role="alert" id="erro">* Atenção, para prosseguir é preciso selecionar uma data. *</div>';
            }else{
                    $sql = "INSERT INTO `agendamento` (`nome`, `data`, `sala`, `computador`, `projetor`, `som`, `microfone`) VALUES ('$nome', '$data', '$sala', '$computador', '$projetor', '$som', '$microfone');";
                    $qur = mysqli_query($link, $sql);
                    echo $sql;
                }
            }           
?>
  • Sorry. Well, you know the previous version Voce used in the banks and the current version ?

  • Read about the function mysqli_error

  • In the code posted there are no errors, played on my server and worked right. Ask the question the other codes involved in the issue. i.e., connection.php, HTML.

  • I have this connection code:<? php $link = mysqli_connect("localhost", "Admin", "admin", "scheduling equipment") or die ("Error connecting to database!"); ?>

  • The version of the bank is the same that used before

  • I used mysqli_error and it returned this message: incorrect date value: '30/01/2018' for column 'data' at Row 1

Show 1 more comment

1 answer

1


I managed to solve the problem, in my code I am using datepicker, and it formats the date to the br standard and my mysql was only accepting the en standard, I have already made the adaptations and it is all right now.

Browser other questions tagged

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