1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] Filtering SQL records from multiple PHP $_POST

Discussão em 'Outras Linguagens' iniciado por Stack, Agosto 12, 2021.

  1. Stack

    Stack Membro Participativo

    I have hit a road block. This used to be a breeze back in the Dreamweaver days. I need to create a SQL Statement that takes multiple variables selected by a user from a form and filter the results on the second page. I have created 3 different statements that successfully work. However, I need to filter more than just one variable. Ultimately it has to look like but with information in the stored $_POST:

    $sql = "SELECT Bus, Month, Day, Year, Shift FROM Bookings WHERE Bus='3' AND Month='3' AND Day='3' AND Year='2021' AND Shift='1' ";


    These statements do work, but I can't add more than 1 $_Post to the statement without getting a 500 error.

    $sql = "SELECT Bus, Month, Day, Year, Shift FROM Bookings WHERE Bus=".$_POST["Bus"];
    $sql = "SELECT Bus, Month, Day, Year, Shift FROM Bookings WHERE Month='3' AND Bus=".$_POST["Bus"];


    Advice would be greatly appreciated!

    Continue reading...

Compartilhe esta Página