Visualizzazione dei risultati da 1 a 3 su 3

Discussione: between doppio

  1. #1

    between doppio

    premessa..non mettetevi a ridere ma mi hanno passato uno script per provare a modificarlo ma dire che sono a 0 e' dire poco..pero' visto che mi attira iniziero' a studiare questo linguaggio..

    in questo script dovrei modificare un between
    questo mi restituisce un numero compreso da a.. e funziona

    if ( $band == "20m" ) {
    $que = "between '14000' and '15000'";
    }
    date_default_timezone_set('UTC');
    MYSQL_CONNECT($hostname, $username, $password) OR DIE("DB connection unavailable");
    @mysql_select_db( "$dbName") or die( "Unable to select database");
    $query = mysql_query("SELECT * FROM spots where freq $que order by datetime desc LIMIT 50");

    come posso inserire una richiesta doppia? cioe' incatenare le 2 richieste che mi ritorni quello compreso nel 1o e 2o between?
    tipo..

    if ( $band == "20m" ) {
    $que = "between '14000' and '15000'";
    $que = "between '21000' and '21070'";
    }



    ..abbiate pieta'.. nn sparatemi lele

  2. #2
    Codice PHP:
    if ( $band == "20m" ) {
    $que1 "between '14000' and '15000'";
    $que2 "between '21000' and '21070'";
    }

    $query mysql_query("SELECT * 
                      FROM spots 
                      where freq (
    $que1) OR freq ($que2)
                      order by datetime desc 
                      LIMIT 50"
    ); 
    non sei chiarissimo, ma prova lo stesso cosi'....

    Il silenzio è spesso la cosa migliore. Pensa ... è gratis.

  3. #3
    intanto grazie piero e buona domenica

    provo a mettere la parte completa dell script,
    praticamente la tabella viene popolata da una serie di frequenze (numeri) e con questa richiesta devo estrapolare una parte di queste limitando da-a..gia col tuo aiuto inizia a funzionare ma all'interno entra anche qualcosa che non e' fra i limiti..dichiarati.. scusa se non riesco ad esprimermi bene ma come dicevo sono...

    il risultato e' qui' http://ik4icz.dyndns.org/clusterselect.php?band=CW


    <head>
    <TITLE>TEST DX Cluster lele</Title>
    <meta http-equiv="refresh" content="60">
    </head>


    <center>
    <?include'clustermenu.php'?> MENU SUPERIORE A BOTTONI


    </p>
    Last 50 Spots for <? echo $band; ?>
    <table width="80%" border="2" align="center" cellpadding="2" cellspacing="1" bordercolor="#0066FF">
    <tr>
    <td width="50"><center>DX Call </td>
    <td width="50"><center>Frequency</td>
    <td width="50"><center>Date/Time (UTC)</td>
    <td width="50"><center>Spotter</td>
    <td width="50"><center>Comments</td>
    </tr>

    <?
    include 'clusterdb.inc.php';

    if ( $band == "LF" ) {
    $que = "<'1000'";
    }

    if ( $band == "HF" ) {
    $que = "between '1000' and '30000'";
    }

    if ( $band == "160m" ) {
    $que = "between '1000' and '2000'";
    }
    if ( $band == "80m" ) {
    $que = "between '3000' and '4000'";
    }

    if ( $band == "40m" ) {
    $que = "between '7000' and '8000'";
    }
    if ( $band == "30m" ) {
    $que = "between '10000' and '11000'";
    }
    if ( $band == "20m" ) {
    $que = "between '14000' and '15000'";
    }
    if ( $band == "17m" ) {
    $que = "between '18000' and '19000'";
    }
    if ( $band == "15m" ) {
    $que = "between '21000' and '22000'";
    }
    if ( $band == "12m" ) {
    $que = "between '24000' and '25000'";
    }
    if ( $band == "10m" ) {
    $que = "between '28000' and '30000'";
    }
    if ( $band == "6m" ) {
    $que = "between '50000' and '60000'";
    }
    if ( $band == "4m" ) {
    $que = "between '70000' and '80000'";
    }
    if ( $band == "VHF" ) {
    $que = "between '30000' and '148000'";
    }

    if ( $band == "2m" ) {
    $que = "between '144000' and '148000'";
    }

    if ( $band == "70cm" ) {
    $que = "between '430000' and '445000'";
    }
    if ( $band == "23cm" ) {
    $que = "between '1200000' and '1300000'";
    }
    if ( $band == "13cm" ) {
    $que = "between '2000000' and '2700000'";
    }
    if ( $band == "9cm" ) {
    $que = "between '3000000' and '4900000'";
    }
    if ( $band == "6cm" ) {
    $que = "between '5000000' and '6700000'";
    }
    if ( $band == "3cm" ) {
    $que = "between '6000000' and '11000000'";
    }
    if ( $band == "mmbands" ) {
    $que = "between '11000000' and '80000000'";
    }

    if ( $band == "CW") {
    $que1 = "between '3500' and '3580'";
    $que2 = "between '7000' and '7040'";
    $que3 = "between '10100' and '10140'";
    $que4 = "between '14000' and '14060'";
    $que5 = "between '18068' and '18095'";
    $que6 = "between '21000' and '21070'";
    $que7 = "between '24890' and '24920'";
    $que8 = "between '28000' and '28070'";
    }
    $query = mysql_query ("SELECT *
    FROM spots
    where freq ($que1) OR freq ($que2) OR freq ($que3) OR freq ($que4) OR freq ($que5) OR freq ($que6) OR freq ($que7) OR freq ($que8)
    order by datetime desc
    LIMIT 50");




    date_default_timezone_set('UTC');
    MYSQL_CONNECT($hostname, $username, $password) OR DIE("DB connection unavailable");
    @mysql_select_db( "$dbName") or die( "Unable to select database");
    $query = mysql_query("SELECT * FROM spots where freq $que order by datetime desc LIMIT 50");

    while ($row = @mysql_fetch_array($query))
    {
    $dxcall=$row["dxcall"];
    $freq=$row["freq"];
    $datetime=$row["datetime"];
    $spotter=$row["spotter"];
    $comments=$row["comments"];

    print ("<tr><center>");
    print ("<td><div align='right'>$dxcall </td>");
    print ("<td><div align='left'> $freq</td>");
    print ("<td><center>");
    $dt = date('d-M-Y H:i ', $datetime);
    echo $dt;
    print ("</td>");
    print ("<td><center>$spotter</td>");

    echo "<td><center>";
    echo strip_tags($comments);
    echo "</td>";
    print ("</tr>");
    }
    ?>
    </table>


    </p>

    </center>

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.