Evaluating bids

Correção em uma consulta mysql

Published on the November 21, 2021 in IT & Programming

About this project

Open

Gostaria de corrigir uma consulta em mysql, preciso que a consulta me retorne a menor data entre 30 dias

O script atual está assim.

$Sql_t2_sec = "select * from curso_modulos where curso_id=111 order by id desc ";
            $result_t2_sec = mysqli_query($conn, $sql_t2_sec);
            while($row_t2_sec = mysqli_fetch_assoc($result_t2_sec)) {

            $sql_t2_sec_mod = "select *,
                              date_format(startdate, '%d-%m-%y') as startdate
            
                              from
                              modulos
                             
                              where
                              startdate between now() - interval 30 day and now() and
                              id=".$Row_t2_sec['modulos_id']."
                             
                              ORDER BY id asc";

            $result_t2_sec_mod = mysqli_query($conn, $sql_t2_sec_mod);
                
                while($row_t2_sec_mod = mysqli_fetch_assoc($result_t2_sec_mod)) {

                    $row_t2_sec_mod_result_id = $row_t2_sec_mod['id'];
                    $row_t2_sec_mod_result       = $row_t2_sec_mod['startdate'];

                    echo "<span style='color: #fff'>";
                    
                    echo $row_t2_sec_mod_result;

                    /*
                    RESULTADO:
31-10-2021
30-10-2021
21-11-2021
20-11-2021                    

Precisava que listagem apaenas 30-10-2021
                    */
                    
                    echo "<br>";
                    echo "</span>";

                }
            }

Category IT & Programming
Subcategory Web development
What is the scope of the project? Small change or bug
Is this a project or a position? Project
Required availability As needed
Roles needed Developer

Delivery term: Not specified

Skills needed

Other projects posted by Thiago S.