• User Newbie

    Estrarre i dati in base al giorno

    Devo organizzare on orario con arrivi e partenze ed
    alcuni orari ci sono solo alcuni giorni della settimana
    da principiante con lo script che segue mi sono
    imbrigliato da solo

    $XGIORNO = "$_POST[GIORNO]";
    $XMESE = "$_POST[MESE]";
    $XANNO = "$_POST[ANNO]";
    $DATA = $XANNO."-".$XMESE."-".$XGIORNO;
    $NUMGIORNO = date('w', mktime(0, 0, 0, $XMESE, $XGIORNO, $XANNO));

    SELECT *,
    TIME_FORMAT(ORARIO,'%H:%i') as XORARIO
    FROM $tabella
    where MEZZO like '%$TIPOMEZZO%'
    and VETTORE like '%$TIPOVETTORE%'
    and PARTENZA like '%$ORIGINE%'
    and ARRIVO like '%$DESTINAZIONE%'
    and LU = '$NUMGIORNO' (il campo contiene 1 oppure ๐Ÿ˜Ž
    and MA = '$NUMGIORNO' (il campo contiene 2 oppure ๐Ÿ˜Ž
    and ME = '$NUMGIORNO' (il campo contiene 3 oppure ๐Ÿ˜Ž
    and GI = '$NUMGIORNO' (il campo contiene 4 oppure ๐Ÿ˜Ž
    and VE = '$NUMGIORNO' (il campo contiene 5 oppure ๐Ÿ˜Ž
    and SA = '$NUMGIORNO' (il campo contiene 6 oppure ๐Ÿ˜Ž
    and DO = '$NUMGIORNO' (il campo contiene 0 oppure ๐Ÿ˜Ž
    and DATAINIZIO >= '$DATA'
    and DATAFINE <= '$DATA'

    Help me
    Grazie