Sql query with filter depending on two values within separate tables

0

Good, I have the following problem I want to do as a filter with sql that shows only the rows that have for example in the column job_date the value 21/02/2017 and in the column job_state the value 1 this is my code, the two are inside the table tareas_diez

 public function mostrar_tarea($datos) {
    $fecha = 21/02/2017;
    $estado = 1;
    $sql = "la consulta con las variables";
    $rs = $this->consulta($sql);
    $registros = "";

    while ($row = mysqli_fetch_array($rs, MYSQLI_ASSOC)) {


        $registros .=  ' <li><a href="#">1 Lorem ipsum dolor sit amet.</a></li>';

    }
    if ($registros == "") {
        $registros = '<tr>';
        $registros .= '<td colspan="5">';
        $registros .= 'No existen registros ...';
        $registros .= '</td>';
        $registros .= '</tr>';
    }

    $arr = array('registros' => $registros);
    return ($arr);
}

I hope you understand and can help me

    
asked by Cesar 09.08.2017 в 23:42
source

1 answer

1

The date should be in quotes and in the same format as in the database engine, here is an example of how it would be

$fecha = "2017/02/21"; $estado = 1; $sql = "select * from nombre_tabla where fecha_tarea = '$fecha' and estado=$estado";

I hope it helps you PS: sorry if there is an error I'm in the cell

    
answered by 10.08.2017 / 00:18
source