How to read this scope?

Asked

Viewed 29 times

-2

I need to see in detail, from what I read and the following:

IF THE $NAME VARIABLE IS PRESENT AND $NAME IS NOT EMPTY RUN: ADD IN THE BASE DATE COLUMN "OATME" LOGIN, AND PASSWORD THE VARIABLES $NAME AND $PASSWORD, UPON $RESULTADO_USUARIO, IF EXECUTED $RESULTADO_USUARIO RUN .. I DON’T KNOW ANYMORE... YOU CAN HELP ME?

if (isset($name) && !empty($name)){

$result_usuario = "INSERT INTO aveime (login, senha) VALUES ('$name', '$password')";

$resultado_usuario = mysqli_query($conn, $result_usuario);

    if($resultado_usuario){

            $_SESSION['id'] = mysqli_insert_id($conn);

            header("Location: form2.php");
    }

1 answer

0

if($resultado_usuario){

    $_SESSION['id'] = mysqli_insert_id($conn);

    header("Location: form2.php");
}

If the record was saved in the bank successfully (if($resultado_usuario)) then takes the ID inserted in the last query to the bank (mysqli_insert_id($conn)) and save him in a second ($_SESSION['id']), then redirects the user to the form2.php page (header("Location: form2.php"))

Ps: If Session is not saving the id, make sure you are logging in at the beginning of the file with session_start();

Browser other questions tagged

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